Impressum

Jewish calendar calculation in Python

Table Of Contents

The Python Date Utilities Libary is needed for Jewish calendar calculation. In Python programs it is imported by import date_utils.calendar_util

Determining if a Jewish year is a leap year

The function date_utils.calendar_util.hebrew_leap(year) returns true when the passed year is a leap year in the Jewish calendar, false otherwise.

Numbering of the Jewish months, converting a Jewish month number into a string

The Jewish months are numbered in the following way:

Name of Jewish monthMonth number
Tishri7
Heshvan8
Kislev9
Tevet10
Shevat11
Adar (in non-leap years), Adar I (in leap years)12
Adar II (in leap years), unused in non-leap years13
Nisan1
Iyar2
Sivan3
Tammuz4
Av5
Elul6

When displaying a month name string, you should distinguish between leap years and non-leap years in order to correctly display the month name of Adar. The following function getJewishMonthName helps:

def getJewishMonthName(month, year):

  if month == 1:
    return "Nisan"
  elif month == 2:
    return "Iyyar"
  elif month == 3:
    return "Sivan"
  elif month == 4:
    return "Tammuz"
  elif month == 5:
    return "Av"
  elif month == 6:
    return "Elul"
  elif month == 7:
    return "Tishri"
  elif month == 8:
    return "Heshvan"
  elif month == 9:
    return "Kislev"
  elif month == 10:
    return "Teveth"
  elif month == 11:
    return "Shevat"
  elif month == 12:
    if date_utils.calendar_util.hebrew_leap(year):
      return "Adar I"
    else:
      return "Adar"
    
  elif month == 13:
    return "Adar II"

Converting Gregorian dates to Jewish dates

In order to convert a Gregorian date to a Jewish date, use the date_utils.calendar_util.gregorian_to_jd function to convert the Gregorian date into a Julian day number and the date_utils.calendar_util.jd_to_hebrew function to convert the Julian day number to a Jewish date.

The date_utils.calendar_util.gregorian_to_jd function takes the year, month, day (in that order) of the Gregorian date and returns the corresponding Julian day number. Then you can pass the returned Julian day number to the date_utils.calendar_util.jd_to_hebrew function which returns a tuple with the Jewish year, month and day of the passed Julian day number.

Example:

julian = date_utils.calendar_util.gregorian_to_jd(gYear, gMonth, gDay)
hebYear, hebMonth, hebDay = date_utils.calendar_util.jd_to_hebrew(julian)

Converting Jewish dates to Gregorian dates

If converting a Jewish date to a Gregorian date, the function date_utils.calendar_util.hebrew_to_jd with parameters year, month, day has to be used to convert a Jewish date into a Julian day number. Then, the function date_utils.calendar_util.jd_to_gregorian converts the Julian day number into a tuple which contains the Gregorian year, month and day of the passed Julian day number.

Example:

julian = date_utils.calendar_util.hebrew_to_jd(hYear, hMonth, hDay)
gYear, gMonth, gDay = date_utils.calendar_util.jd_to_gregorian(julian)

Getting the weekday of a Gregorian or Jewish date

The following function getWeekday returns the weekday number for the given julian day number. 0 is Sunday, 1 is Monday and so on.

def getWeekday(julian):
  weekday = (int(julian) + 2) % 7
  return weekday

Getting the number of days in a Gregorian or Jewish month

The number of days in a Jewish Month can be returned by the function date_utils.calendar_util.hebrew_month_days(year, month) which takes the year and the month in that order as parameters.

A function for getting the last day in a gregorian month:

def getLastDayOfGregorianMonth(month, year):
  if month == 2 and date_utils.calendar_util.leap_gregorian(year):
    return 29
  else:
    month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    return month_days[month-1]

Sunrise, sunset, degrees below horizons, proportional hours

import math

# FormatTime12, FormatTime24
# GetSunrise, GetSunriseDegreesBelowHorizon
# GetSunset, GetSunsetDegreesBelowHorizon
# AddMinutes, SubtractMinutes
# GetProportionalHours, GetShaaZmanit

# Methods for Shabbat time calculation:
# location is a tuple (latitude, longitude, timezone, elevation)
# For example: Pforzheim has the tuple (4854, 842, 1, 257)
#
# GetSunset(uMonth, uDay, uYear, location)
# GetSunsetDegreesBelowHorizon(uMonth, uDay, uYear,
#                   fDegreesBelowHorizon, location)
# AddMinutes(time, min)
# SubtractMinutes(time, min)

locationPforzheim = (4854, 842, 1, 263)

def FormatTime12(time):
  if time == None:
    return "--:--"

  hour = time[0]
  min = time[1]

  hourModulo12 = hour % 12
  if (hourModulo12 == 0):
    hourModulo12 = 12

  if (hour >= 12):
    ampm = "PM"
  else:
    ampm = "AM"

  if (hourModulo12 < 10):
    hourStr = "0" + str(hourModulo12)
  else:
    hourStr = str(hourModulo12)
  if (min < 10):
    minStr = "0" + str(min)
  else:
    minStr = str(min)
  return hourStr + ":" + minStr + ampm

def FormatTime24(time):
  if time == None:
    return "--:--"

  hour = time[0]
  min = time[1]

  if (hour < 10):
    hourStr = "0" + str(hour)
  else:
    hourStr = str(hour)
  if (min < 10):
    minStr = "0" + str(min)
  else:
    minStr = str(min)
  return hourStr + ":" + minStr

def FormatTimeShaaZmanit(time):
  if time == None:
    return "--:--"

  hour = time[0]
  min = time[1]

  if (hour < 10):
    hourStr = "0" + str(hour)
  else:
    hourStr = str(hour)
  if (min < 10):
    minStr = "0" + str(min)
  else:
    minStr = str(min)
  return hourStr + ":" + minStr

def leap(y):
  if (y % 400 == 0):
    return True
  if (y % 100 != 0):
    if (y % 4 == 0):
      return True
  return False

def doy(d, m, y):
  monCount = [0, 1, 32, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366]
  if ((m > 2) and (leap(y))):
    return monCount[m] + d + 1
  else:
    return monCount[m] + d

def todec(deg, min):
  return (deg + min / 60.0)

def M(x):
  return (0.9856 * x - 3.251)

def L(x):
  return (x + 1.916 * math.sin(0.01745 * x) + 0.02 * math.sin(2 * 0.01745 * x) + 282.565)

def adj(x):
  return (-0.06571 * x - 6.620)

def float_abs(x):
  if (x < 0.0):
    return (-x)
  else:
    return (x)

def suntime(d, m, y, \
            zendeg, zenmin, \
            londeg, lonmin, ew, \
            latdeg, latmin, ns, \
            tz, \
            elevation): # Elevation in meters
  if (zendeg == 90):
    earthRadiusInMeters = 6356.9 * 1000.0
    elevationAdjustment = math.degrees \
      (math.acos(earthRadiusInMeters / (earthRadiusInMeters + elevation)))

    z = zendeg + zenmin / 60.0
    z += elevationAdjustment
    zendeg = math.floor(z)
    zenmin = (z - math.floor(z)) * 60

  day = doy(d, m, y)
  cosz = math.cos(0.01745 * todec(zendeg, zenmin))

  longitude = todec(londeg, lonmin)
  if ew != 0:
    longitude *= -1
  lonhr     = longitude / 15.0
  latitude  = todec(latdeg, latmin)
  if ns != 0:
    latitude *= -1
  coslat    = math.cos(0.01745 * latitude)
  sinlat    = math.sin(0.01745 * latitude)

  t_rise = day + (6.0 + lonhr) / 24.0
  t_set  = day + (18.0 + lonhr) / 24.0

  xm_rise = M(t_rise)
  xl_rise = L(xm_rise)
  xm_set  = M(t_set)
  xl_set  = L(xm_set)
  
  a_rise = 57.29578 * math.atan( 0.91746 * math.tan(0.01745 * xl_rise) )
  a_set  = 57.29578 * math.atan( 0.91746 * math.tan(0.01745 * xl_set) )
  if (float_abs(a_rise + 360.0 - xl_rise) > 90.0):
    a_rise += 180.0
  if (a_rise > 360.0):
    a_rise -= 360.0

  if (float_abs(a_set + 360.0 - xl_set) > 90.0):
    a_set += 180.0
  if (a_set > 360.0):
    a_set -= 360.0

  ahr_rise = a_rise / 15.0
  sindec = 0.39782 * math.sin(0.01745 * xl_rise)
  cosdec = math.sqrt(1.0 - sindec * sindec)
  h_rise = (cosz - sindec * sinlat) / (cosdec * coslat)

  ahr_set = a_set / 15.0
  sindec = 0.39782 * math.sin(0.01745 * xl_set)
  cosdec = math.sqrt(1.0 - sindec * sindec)
  h_set = (cosz - sindec * sinlat) / (cosdec * coslat)

  if (float_abs(h_rise) <= 1.0):
    h_rise = 57.29578 * math.acos(h_rise)
  else:
    return None # NO_SUNRISE

  if (float_abs(h_set) <= 1.0):
    h_set = 57.29578 * math.acos(h_set)
  else:
    return None # NO_SUNSET
  ut_rise  = ((360.0 - h_rise) / 15.0) + ahr_rise + adj(t_rise) + lonhr
  ut_set  = (h_rise / 15.0) + ahr_set + adj(t_set) + lonhr

  returnSunrise = ut_rise + tz  # sunrise
  returnSunset = ut_set  + tz  # sunset
  return (returnSunrise, returnSunset)

def timeadj(t):
  if (t < 0):
    t += 24.0

  hour = int(math.floor(t))
  min  = int(math.floor((t - hour) * 60.0 + 0.5))

  if (min >= 60):
    hour += 1
    min  -= 60

  if (hour > 24):
    hour -= 24

  return [hour, min]

def GetDegreesBelowHorizonAdd(uMonth, uDay, uYear, \
				fDegreesBelowHorizon, \
				location):
  iLatitude, iLongitude, iTimeZone, elevation = location
  if (iLongitude < 0):
    longitudeFlag = 0
  else:
    longitudeFlag = 1
  if (iLatitude < 0):
    latitudeFlag = 1
  else:
    latitudeFlag = 0
  returnTimes = suntime(uDay, uMonth, uYear, \
	      90, 50,  \
	      int(math.floor(math.fabs(iLongitude / 100))),  \
		int(math.floor(math.fabs(iLongitude % 100))), longitudeFlag, \
	      int(math.floor(math.fabs(iLatitude / 100))),  \
		int(math.floor(math.fabs(iLatitude % 100))), latitudeFlag, \
	      iTimeZone, elevation);
  if (returnTimes != ""):
    srTime = timeadj(returnTimes[1])
    while (srTime[0] > 12):
      srTime[0] -= 12

    db = fDegreesBelowHorizon + 90.0
    deghour = math.floor(db)
    db = db - deghour
    db *= 60.0
    degmin = math.floor(db)
    returnTimes = suntime(uDay, uMonth, uYear, \
		deghour, degmin, \
		int(math.floor(math.fabs(iLongitude / 100))), \
		  int(math.floor(math.fabs(iLongitude % 100))), longitudeFlag, \
		int(math.floor(math.fabs(iLatitude / 100))),  \
		  int(math.floor(math.fabs(iLatitude % 100))), latitudeFlag, \
		iTimeZone, elevation)
    if (returnTimes != ""):
      dbTime = timeadj(returnTimes[1])
      while (dbTime[0] > 12):
        dbTime[0] -= 12

      srTimeValue = srTime[0] * 60 + srTime[1]
      dbTimeValue = dbTime[0] * 60 + dbTime[1]
      return dbTimeValue - srTimeValue
  return None

def GetSunrise(uMonth, uDay, uYear, location):
  iLatitude, iLongitude, iTimeZone, elevation = location
  if (iLongitude < 0):
    longitudeFlag = 0
  else:
    longitudeFlag = 1
  if (iLatitude < 0):
    latitudeFlag = 1
  else:
    latitudeFlag = 0
  returnTimes = suntime(uDay, uMonth, uYear, \
	      90, 50,  \
	      int(math.floor(math.fabs(iLongitude / 100))),  \
		int(math.floor(math.fabs(iLongitude % 100))), longitudeFlag, \
	      int(math.floor(math.fabs(iLatitude / 100))),  \
		int(math.floor(math.fabs(iLatitude % 100))), latitudeFlag, \
	      iTimeZone, elevation)
  if (returnTimes != ""):
    returnTime = timeadj(returnTimes[0])
    
    while (returnTime[0] > 12):
      returnTime[0] -= 12
    
    return returnTime
  else:
    return None

def GetSunriseDegreesBelowHorizon(uMonth, uDay, uYear, \
				      fDegreesBelowHorizon, \
				      location):
  t = GetSunrise(uMonth, uDay, uYear, location)
  if (t != None):
    adding = GetDegreesBelowHorizonAdd(uMonth, uDay, uYear, fDegreesBelowHorizon, location)
    if (adding != None):
      return SubtractMinutes(t, adding)
    else:
      return None
  else:
    return None

def GetSunset(uMonth, uDay, uYear, \
		   location):
  iLatitude, iLongitude, iTimeZone, elevation = location
  if (iLongitude < 0):
    longitudeFlag = 0
  else:
    longitudeFlag = 1
  if (iLatitude < 0):
    latitudeFlag = 1
  else:
    latitudeFlag = 0
  returnTimes = suntime(uDay, uMonth, uYear, \
	      90, 50,  \
	      int(math.floor(math.fabs(iLongitude / 100))),  \
		int(math.floor(math.fabs(iLongitude % 100))), longitudeFlag, \
	      int(math.floor(math.fabs(iLatitude / 100))),  \
		int(math.floor(math.fabs(iLatitude % 100))), latitudeFlag, \
	      iTimeZone, elevation)
  if (returnTimes != None):
    returnTime = timeadj(returnTimes[1])

    while (returnTime[0] < 12):
      returnTime[0] += 12

    return returnTime
  else:
    return None

def GetSunsetDegreesBelowHorizon(uMonth, uDay, uYear, \
				      fDegreesBelowHorizon, \
				      location):
  t = GetSunset(uMonth, uDay, uYear, location)
  if (t != ""):
    adding = GetDegreesBelowHorizonAdd(uMonth, uDay, uYear, fDegreesBelowHorizon, location)
    if (adding != None):
      return AddMinutes(t, adding)
    else:
      return None
  else:
    return None

def AddMinutes(time, min):
  if (time == None):
    return None
  time2 = time
  time2[1] += min
  while (time2[1] >= 60):
    time2[1] -= 60
    time2[0] += 1
  return time2

def SubtractMinutes(time, min):
  if (time == None):
    return None
  time2 = time
  time2[1] -= min
  while (time2[1] < 0):
    time2[1] += 60
    time2[0] -= 1
  return time2

def GetProportionalHours(value, sunrise, sunset):
  if (sunrise == None or sunset == None):
    return None
  sr = sunrise[0] * 60 + sunrise[1]
  ss = sunset[0] * 60 + sunset[1]
  retval = sr + math.floor(((ss-sr) * value) / 12)
  return [int(math.floor(retval / 60)), int(retval % 60)]

def GetShaaZmanit(sunrise, sunset):
  sr = sunrise[0] * 60 + sunrise[1]
  ss = sunset[0] * 60 + sunset[1]
  return int(math.floor((ss - sr) / 12))

Calculating Israeli Daylight Savings Time

Daylight Savings Time starts in Israel on the last Friday before 2nd of April and ends on the Sunday between Rosh Hashana and Yom Kippur. The following function isIsraeliDaylightSavingsTime checks for a Gregorian date whether Daylight Savings Time in Israel is in effect on that day or not.

def getWeekday(julian):
  weekday = (int(julian) + 2) % 7
  return weekday

def isIsraeliDaylightSavingsTime(day, month, year):
  jdStart = date_utils.calendar_util.gregorian_to_jd(year,
         4,
         2)
  jdStart -= 1
  while getWeekday(jdStart) != 5: # Friday
    jdStart -= 1

  jd = date_utils.calendar_util.gregorian_to_jd(year, 12, 31)
  heb = date_utils.calendar_util.jd_to_hebrew(jd)
  jdEnd = date_utils.calendar_util.hebrew_to_jd(heb[0], 7, 9) # 9 Tishri
  while getWeekday(jdEnd) != 0: # Sunday
    jdEnd -= 1

  jd_now = date_utils.calendar_util.gregorian_to_jd(year, month, day)
  if int(jd_now) >= int(jdStart) and int(jd_now) < int(jdEnd):
    return True
  else:
    return False

Calculating Jewish holidays

A list of the holidays with their dates and remarks for calculation is available here.

The following function calculate_holiday takes a Gregorian date and a flag whether for Diaspora is calculated or not, and returns a list of holiday names.

import date_utils.calendar_util

# Returns the weekday from a given hebrew date (0 for Sunday,
# 1 for Monday,...)
def getWeekdayOfHebrewDate(hebDay, hebMonth, hebYear):
  # Calculating the julian date
  julian = date_utils.calendar_util.hebrew_to_jd(hebYear, hebMonth, hebDay)
  weekday = (int(julian) + 2) % 7
  return weekday

def calculate_holiday(g_day, g_month, g_year, diaspora):
  julian = date_utils.calendar_util.gregorian_to_jd(g_year, g_month, g_day)
  hebYear, hebMonth, hebDay = date_utils.calendar_util.jd_to_hebrew(julian)

  listHolidays = []

  # Holidays in Nisan

  hagadolDay = 14
  while getWeekdayOfHebrewDate(hagadolDay, 1, hebYear) != 6:
    hagadolDay -= 1
  if hebDay == hagadolDay and hebMonth == 1:
    listHolidays.append("Shabat Hagadol")

  if hebDay == 14 and hebMonth == 1:
    listHolidays.append("Erev Pesach")
  if hebDay == 15 and hebMonth == 1:
    listHolidays.append("Pesach I")
  if hebDay == 16 and hebMonth == 1:
    if diaspora:
      listHolidays.append("Pesach II")
    else:
      listHolidays.append("Chol Hamoed")
  if hebDay == 17 and hebMonth == 1:
    listHolidays.append("Chol Hamoed")
  if hebDay == 18 and hebMonth == 1:
    listHolidays.append("Chol Hamoed")
  if hebDay == 19 and hebMonth == 1:
    listHolidays.append("Chol Hamoed")
  if hebDay == 20 and hebMonth == 1:
    listHolidays.append("Chol Hamoed")
  if hebDay == 21 and hebMonth == 1:
    if not diaspora:
      listHolidays.append("Pesach VII (Yizkor)")
    else:
      listHolidays.append("Pesach VII")
  if hebDay == 22 and hebMonth == 1:
    if diaspora:
      listHolidays.append("Pesach VIII (Yizkor)")

  # Yom Hashoah

  if getWeekdayOfHebrewDate(27, 1, hebYear) == 5:
    if hebDay == 26 and hebMonth == 1:
      listHolidays.append("Yom Hashoah")
  elif hebYear >= 5757 and getWeekdayOfHebrewDate(27, 1, hebYear) == 0:
    if hebDay == 28 and hebMonth == 1:
      listHolidays.append("Yom Hashoah")
  else:
    if hebDay == 27 and hebMonth == 1:
      listHolidays.append("Yom Hashoah")

  # Holidays in Iyar

  # Yom Hazikaron

  if getWeekdayOfHebrewDate(4, 2, hebYear) == 5: # If 4th of Iyar is a Thursday ...
    if hebDay == 2 and hebMonth == 2: # ... then Yom Hazicaron is on 2th of Iyar
      listHolidays.append("Yom Hazikaron")
  elif getWeekdayOfHebrewDate(4, 2, hebYear) == 4:
    if hebDay == 3 and hebMonth == 2:
        listHolidays.append("Yom Hazikaron")
  elif hebYear >= 5764 and getWeekdayOfHebrewDate(4, 2, hebYear) == 0:
    if hebDay == 5 and hebMonth == 2:
      listHolidays.append("Yom Hazikaron")
  else:
    if hebDay == 4 and hebMonth == 2:
      listHolidays.append("Yom Hazikaron")

  # Yom Ha'Azmaut

  if getWeekdayOfHebrewDate(5, 2, hebYear) == 6:
    if hebDay == 3 and hebMonth == 2:
      listHolidays.append("Yom Ha'Atzmaut")
  elif getWeekdayOfHebrewDate(5, 2, hebYear) == 5:
    if hebDay == 4 and hebMonth == 2:
      listHolidays.append("Yom Ha'Atzmaut")
  elif hebYear >= 5764 and getWeekdayOfHebrewDate(4, 2, hebYear) == 0:
    if hebDay == 6 and hebMonth == 2:
      listHolidays.append("Yom Ha'Atzmaut")
  else:
    if hebDay == 5 and hebMonth == 2:
      listHolidays.append("Yom Ha'Atzmaut")

  if hebDay == 14 and hebMonth == 2:
    listHolidays.append("Pesach Sheni")
  if hebDay == 18 and hebMonth == 2:
    listHolidays.append("Lag B'Omer")
  if hebDay == 28 and hebMonth == 2:
    listHolidays.append("Yom Yerushalayim")

  # Holidays in Sivan

  if hebDay == 5 and hebMonth == 3:
    listHolidays.append("Erev Shavuot")
  if hebDay == 6 and hebMonth == 3:
    if diaspora:
      listHolidays.append("Shavuot I")
    else:
      listHolidays.append("Shavuot\n(Yizkor)")
  if hebDay == 7 and hebMonth == 3:
    if diaspora:
      listHolidays.append("Shavuot II\n(Yizkor)")

  # Holidays in Tammuz

  if getWeekdayOfHebrewDate(17, 4, hebYear) == 6:
    if hebDay == 18 and hebMonth == 4:
      listHolidays.append("Fast of Tammuz")
  else:
    if hebDay == 17 and hebMonth == 4:
      listHolidays.append("Fast of Tammuz")

  # Holidays in Av

  if getWeekdayOfHebrewDate(9, 5, hebYear) == 6:
    if hebDay == 10 and hebMonth == 5:
      listHolidays.append("Fast of Av")
  else:
    if hebDay == 9 and hebMonth == 5:
      listHolidays.append("Fast of Av")
  if hebDay == 15 and hebMonth == 5:
    listHolidays.append("Tu B'Av")

  # Holidays in Elul

  if hebDay == 29 and hebMonth == 6:
    listHolidays.append("Erev Rosh Hashana")

  # Holidays in Tishri

  if hebDay == 1 and hebMonth == 7:
    listHolidays.append("Rosh Hashana I")
  if hebDay == 2 and hebMonth == 7:
    listHolidays.append("Rosh Hashana II")
  if getWeekdayOfHebrewDate(3, 7, hebYear) == 6:
    if hebDay == 4 and hebMonth == 7:
      listHolidays.append("Tzom Gedaliah")
  else:
    if hebDay == 3 and hebMonth == 7:
      listHolidays.append("Tzom Gedaliah")
  if hebDay == 9 and hebMonth == 7:
    listHolidays.append("Erev Yom Kippur")
  if hebDay == 10 and hebMonth == 7:
    listHolidays.append("Yom Kippur\n(Yizkor)")
  if hebDay == 14 and hebMonth == 7:
    listHolidays.append("Erev Sukkot")
  if hebDay == 15 and hebMonth == 7:
    if diaspora:
      listHolidays.append("Sukkot I")
    else:
      listHolidays.append("Sukkot")
  if hebDay == 16 and hebMonth == 7:
    if diaspora:
      listHolidays.append("Sukkot II")
    else:
      listHolidays.append("Chol Hamoed")
  if hebDay == 17 and hebMonth == 7:
    listHolidays.append("Chol Hamoed")
  if hebDay == 18 and hebMonth == 7:
    listHolidays.append("Chol Hamoed")
  if hebDay == 19 and hebMonth == 7:
    listHolidays.append("Chol Hamoed")
  if hebDay == 20 and hebMonth == 7:
    listHolidays.append("Chol Hamoed")
  if hebDay == 21 and hebMonth == 7:
    listHolidays.append("Hoshana Raba")
  if hebDay == 22 and hebMonth == 7:
    if not diaspora:
      listHolidays.append("Shemini Atzereth\n(Yizkor)")
      listHolidays.append("Simchat Torah")
    else:
      listHolidays.append("Shemini Atzereth\n(Yizkor)")
  if hebDay == 23 and hebMonth == 7:
    if diaspora:
      listHolidays.append("Simchat Torah")

  # Holidays in Kislev

  if hebDay == 25 and hebMonth == 9:
    listHolidays.append("Chanukka I")
  if hebDay == 26 and hebMonth == 9:
    listHolidays.append("Chanukka II")
  if hebDay == 27 and hebMonth == 9:
    listHolidays.append("Chanukka III")
  if hebDay == 28 and hebMonth == 9:
    listHolidays.append("Chanukka IV")
  if hebDay == 29 and hebMonth == 9:
    listHolidays.append("Chanukka V")
  # Holidays in Tevet

  if hebDay == 10 and hebMonth == 10:
    listHolidays.append("Fast of Tevet")

  if date_utils.calendar_util.hebrew_month_days(hebYear, 9) == 30:
    if hebDay == 30 and hebMonth == 9:
      listHolidays.append("Chanukka VI")
    if hebDay == 1 and hebMonth == 10:
      listHolidays.append("Chanukka VII")
    if hebDay == 2 and hebMonth == 10:
      listHolidays.append("Chanukka VIII")
  if date_utils.calendar_util.hebrew_month_days(hebYear, 9) == 29:
    if hebDay == 1 and hebMonth == 10:
      listHolidays.append("Chanukka VI")
    if hebDay == 2 and hebMonth == 10:
      listHolidays.append("Chanukka VII")
    if hebDay == 3 and hebMonth == 10:
      listHolidays.append("Chanukka VIII")

  # Holidays in Shevat

  if hebDay == 15 and hebMonth == 11:
    listHolidays.append("Tu B'Shevat")

  # Holidays in Adar (I)/Adar II

  if date_utils.calendar_util.hebrew_leap(hebYear):
    monthEsther = 13
  else:
    monthEsther = 12
    
  if getWeekdayOfHebrewDate(13, monthEsther, hebYear) == 6:
    if hebDay == 11 and hebMonth == monthEsther:
      listHolidays.append("Fast of Esther")
  else:
    if hebDay == 13 and hebMonth == monthEsther:
      listHolidays.append("Fast of Esther")

  if hebDay == 14 and hebMonth == monthEsther:
    listHolidays.append("Purim")
  if hebDay == 15 and hebMonth == monthEsther:
    listHolidays.append("Shushan Purim")

  if date_utils.calendar_util.hebrew_leap(hebYear):
    if hebDay == 14 and hebMonth == 12:
      listHolidays.append("Purim Katan")
    if hebDay == 15 and hebMonth == 12:
      listHolidays.append("Shushan Purim Katan")

  return listHolidays

A test program for the holiday calculation is:

year = int(raw_input("Gregorian Year? "))
nonleapgmonths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
leapgmonths = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
for month in range(1,13):
  if date_utils.calendar_util.leap_gregorian(year):
    lastDay = leapgmonths[month-1]
  else:
    lastDay = nonleapgmonths[month-1]
  for day in range(1,lastDay+1):
    holidays = calculate_holiday(day, month, year, True)
    if len(holidays) > 0:
      print str(day) + "/" + str(month) + "/" + str(year) + ": " + str(holidays)

Calculating weekly torah sections

The function getTorahSections in torah.py expects the Jewish month, day and year of the Shabbat and a boolean whether to calculate for diaspora (True) or Israel (False) and returns a string with the torah sections or an empty string if there are no torah sections on that day.

File torah.py

import date_utils.calendar_util

ID_BERESHITH                   = 0;
ID_NOAH                        = 1;
ID_LEHLEHA                     = 2;
ID_VAYERA                      = 3;
ID_HAYESARAH                   = 4;
ID_TOLEDOTH                    = 5;
ID_VAYETSE                     = 6;
ID_VAYISHLAH                   = 7;
ID_VAYESHEB                    = 8;
ID_MIKKETS                     = 9;
ID_VAYIGGASH                  = 10;
ID_VAYHEE                     = 11;
ID_SHEMOTH                    = 12;
ID_VAERA                      = 13;
ID_BO                         = 14;
ID_BESHALLAH                  = 15;
ID_YITHRO                     = 16;
ID_MISHPATIM                  = 17;
ID_TERUMAH                    = 18;
ID_TETSAVVEH                  = 19;
ID_KITISSA                    = 20;
ID_VAYAKHEL                   = 21;
ID_PEKUDE                     = 22;
ID_VAYIKRA                    = 23;
ID_TSAV                       = 24;
ID_SHEMINI                    = 25;
ID_TAZRIANG                   = 26;
ID_METSORANG                  = 27;
ID_AHAREMOTH                  = 28;
ID_KEDOSHIM                   = 29;
ID_EMOR                       = 30;
ID_BEHAR                      = 31;
ID_BEHUKKOTHAI                = 32;
ID_BEMIDBAR                   = 33;
ID_NASO                       = 34;
ID_BEHAALOTEHA                = 35;
ID_SHELAHLEHA                 = 36;
ID_KORAH                      = 37;
ID_HUKATH                     = 38;
ID_BALAK                      = 39;
ID_PINHAS                     = 40;
ID_MATOTH                     = 41;
ID_MASEH                      = 42;
ID_DEBARIM                    = 43;
ID_VAETHANAN                  = 44;
ID_EKEB                       = 45;
ID_REEH                       = 46;
ID_SHOFETIM                   = 47;
ID_KITETSE                    = 48;
ID_KITABO                     = 49;
ID_NITSABIM                   = 50;
ID_VAYELEH                    = 51;
ID_HAAZINU                    = 52;

ID_SIMHATHTORAH               = 53;
ID_SIMHATHTORAH_2             = 54;
ID_SIMHATHTORAH_3             = 55;

ID_ROSH_HODESH_SHABBAT        = 60;
ID_SHEKALIM                   = 61;
ID_ZAHOR                      = 62;
ID_PARAH                      = 63;
ID_HAHODESH                   = 64;
ID_HAGGADOL                   = 65;
ID_SHUVA                      = 66;

ID_ROSH_HASHANAH_I            = 70;
ID_ROSH_HASHANAH_II           = 71;
ID_FAST_OF_GEDALIAH           = 72;
ID_YOM_KIPPUR                 = 73;
ID_SUCCOTH_I                  = 74;
ID_SUCCOTH_II                 = 75;
ID_SUCCOTH_III_NO_SHABBAT     = 76;
ID_SUCCOTH_III                = 77;
ID_SUCCOTH_IV                 = 78;
ID_SUCCOTH_V_NO_SHABBAT       = 79;
ID_SUCCOTH_V                  = 80;
ID_SUCCOTH_VI_NO_SHABBAT      = 81;
ID_SUCCOTH_VI                 = 82;
ID_HOSHANAH_RABBAH            = 83;
ID_HOL_HAMOED_SUCCOTH         = 84;
ID_SHEMINI_AZERETH_1          = 85;
ID_FAST_OF_ESTHER             = 86;
ID_PURIM                      = 87;
ID_FAST_OF_TEVET_10           = 88;
ID_PESAH_I                    = 89;
ID_HOL_HAMOED_PESAH           = 90;
ID_PESAH_VII                  = 91;
ID_PESAH_VIII                 = 92;
ID_PESAH_VIII_NO_SHABBAT      = 93;
ID_SHAVUOTH_I                 = 94;
ID_SHAVUOTH_II_NO_SHABBAT     = 95; 
ID_SHAVUOTH_II                = 96;
ID_YOM_HAATZMAUT              = 97;
ID_FAST_OF_TAMMUZ_17          = 98;
ID_FAST_OF_TISHA_BAV          = 99;
ID_CHANUKKAH_I               = 100;
ID_CHANUKKAH_II              = 101;
ID_CHANUKKAH_III             = 102;
ID_CHANUKKAH_IV              = 103;
ID_CHANUKKAH_V               = 104;
ID_CHANUKKAH_VI              = 105;
ID_CHANUKKAH_VI_ROSH_HODESH  = 106;
ID_CHANUKKAH_VII             = 107;
ID_CHANUKKAH_VII_ROSH_HODESH = 108;
ID_CHANUKKAH_VIII            = 109;
ID_SECOND_SHABBAT_CHANUKKAH  = 110;
ID_ROSH_HODESH               = 111;
ID_PESAH_II                  = 112;
ID_PESAH_III                 = 113;
ID_PESAH_IV                  = 114;
ID_PESAH_IV_NOT_SUNDAY       = 115;
ID_PESAH_IV_SUNDAY           = 116;
ID_PESAH_V                   = 117;
ID_PESAH_V_NOT_MONDAY        = 118;
ID_PESAH_V_MONDAY            = 119;
ID_PESAH_VI                  = 120;

ID_SPECIAL_1                  = 150;
ID_SPECIAL_2                  = 151;
ID_SPECIAL_3                  = 152;
ID_SPECIAL_4                  = 153;
ID_SPECIAL_5                  = 154;
ID_SPECIAL_6                  = 155;
ID_SPECIAL_7                  = 156;
ID_SPECIAL_8                  = 157;
ID_SPECIAL_8A                 = 158;
ID_SPECIAL_9                  = 159;
ID_SPECIAL_10                 = 161;
ID_SPECIAL_11                 = 162;
ID_SPECIAL_12                 = 163;

ID_SHEMINI_AZERETH_2          = 170;
ID_SHEMINI_AZERETH_3          = 171;
ID_SHEMINI_AZERETH            = 172;

ID_MAX                        = 256;

ID_NULL                       = 1000;

torahSectionsA = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_SHEKALIM,ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_ZAHOR,   ID_NULL,      # 20 
   ID_KITISSA,             ID_PARAH,   ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_PEKUDE,  ID_HAHODESH,  # 22 
   ID_VAYIKRA,             ID_NULL,    ID_NULL,      # 24 
   ID_TSAV,                ID_HAGGADOL,ID_NULL,      # 25 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 26 
   ID_SHEMINI,             ID_NULL,    ID_NULL,      # 27 
   ID_TAZRIANG,           ID_METSORANG,ID_NULL,      # 28 
   ID_AHAREMOTH,           ID_KEDOSHIM,ID_NULL,      # 29 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 30 
   ID_BEHAR,            ID_BEHUKKOTHAI,ID_NULL,      # 31 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 32 
   ID_NASO,                ID_NULL,    ID_NULL,      # 33 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 34 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 35 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 36 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 37 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 38 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 39 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 40 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 41 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 42 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 43 
   ID_REEH,                ID_NULL,    ID_NULL,      # 44 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 45 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 46 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 47 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 48 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 49 
   ID_YOM_KIPPUR,          ID_NULL,    ID_NULL,      # 50 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 51 

torahSectionsB = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_SHEKALIM,ID_NULL,      # 18 
   ID_TERUMAH,             ID_ZAHOR,   ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_PARAH,   ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_PEKUDE,  ID_HAHODESH,  # 22 
   ID_VAYIKRA,             ID_NULL,    ID_NULL,      # 23 
   ID_TSAV,                ID_HAGGADOL,ID_NULL,      # 24 
   ID_PESAH_VII,           ID_NULL,    ID_NULL,      # 25 
   ID_SHEMINI,             ID_NULL,    ID_NULL,      # 26 
   ID_TAZRIANG,           ID_METSORANG,ID_NULL,      # 27 
   ID_AHAREMOTH,           ID_KEDOSHIM,ID_NULL,      # 28 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 29 
   ID_BEHAR,            ID_BEHUKKOTHAI,ID_NULL,      # 30 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 31 
   ID_NASO,                ID_NULL,    ID_NULL,      # 32 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 33 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 34 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 35 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 36 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 37 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 38 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 39 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 40 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 41 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 42 
   ID_REEH,                ID_NULL,    ID_NULL,      # 43 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 44 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 45 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 46 
   ID_NITSABIM,            ID_NULL,    ID_NULL,      # 47 
   ID_VAYELEH,             ID_NULL,    ID_NULL,      # 48 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 49 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 50 

torahSectionsCDiaspora = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_SHEKALIM,ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_ZAHOR,   ID_NULL,      # 20 
   ID_KITISSA,             ID_PARAH,   ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_PEKUDE,  ID_HAHODESH,  # 22 
   ID_VAYIKRA,             ID_NULL,    ID_NULL,      # 24 
   ID_TSAV,                ID_HAGGADOL,ID_NULL,      # 25 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 26 
   ID_SHEMINI,             ID_NULL,    ID_NULL,      # 27 
   ID_TAZRIANG,           ID_METSORANG,ID_NULL,      # 28 
   ID_AHAREMOTH,           ID_KEDOSHIM,ID_NULL,      # 29 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 30 
   ID_BEHAR,            ID_BEHUKKOTHAI,ID_NULL,      # 31 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 32 
   ID_SHAVUOTH_II,         ID_NULL,    ID_NULL,      # 33 
   ID_NASO,                ID_NULL,    ID_NULL,      # 34 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 35 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 36 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 37 
   ID_HUKATH,              ID_BALAK,   ID_NULL,      # 38 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 39 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 40 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 41 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 42 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 43 
   ID_REEH,                ID_NULL,    ID_NULL,      # 44 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 45 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 46 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 47 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 48 
   ID_ROSH_HASHANAH_I,     ID_NULL,    ID_NULL,      # 49 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 50 
   ID_SUCCOTH_I,           ID_NULL,    ID_NULL,      # 51 
   ID_SHEMINI_AZERETH,     ID_NULL,    ID_NULL];     # 52 

torahSectionsCIsrael = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_SHEKALIM,ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_ZAHOR,   ID_NULL,      # 20 
   ID_KITISSA,             ID_PARAH,   ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_PEKUDE,  ID_HAHODESH,  # 22 
   ID_VAYIKRA,             ID_NULL,    ID_NULL,      # 24 
   ID_TSAV,                ID_HAGGADOL,ID_NULL,      # 25 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 26 
   ID_SHEMINI,             ID_NULL,    ID_NULL,      # 27 
   ID_TAZRIANG,           ID_METSORANG,ID_NULL,      # 28 
   ID_AHAREMOTH,           ID_KEDOSHIM,ID_NULL,      # 29 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 30 
   ID_BEHAR,            ID_BEHUKKOTHAI,ID_NULL,      # 31 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 32 
   ID_NASO,                ID_NULL,    ID_NULL,      # 33 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 34 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 35 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 36 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 37 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 38 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 39 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 40 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 41 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 42 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 43 
   ID_REEH,                ID_NULL,    ID_NULL,      # 44 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 45 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 46 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 47 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 48 
   ID_ROSH_HASHANAH_I,     ID_NULL,    ID_NULL,      # 49 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 50 
   ID_SUCCOTH_I,           ID_NULL,    ID_NULL,      # 51 
   ID_SHEMINI_AZERETH,     ID_NULL,    ID_NULL];     # 52 

torahSectionsDDiaspora = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_SHEKALIM,ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_ZAHOR,   ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_PEKUDE,  ID_PARAH,     # 22 
   ID_VAYIKRA,             ID_HAHODESH,ID_NULL,      # 23 
   ID_TSAV,                ID_HAGGADOL,ID_NULL,      # 24 
   ID_PESAH_I,             ID_NULL,    ID_NULL,      # 25 
   ID_PESAH_VIII,          ID_NULL,    ID_NULL,      # 26 
   ID_SHEMINI,             ID_NULL,    ID_NULL,      # 27 
   ID_TAZRIANG,           ID_METSORANG,ID_NULL,      # 28 
   ID_AHAREMOTH,           ID_KEDOSHIM,ID_NULL,      # 29 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 30 
   ID_BEHAR,            ID_BEHUKKOTHAI,ID_NULL,      # 31 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 32 
   ID_NASO,                ID_NULL,    ID_NULL,      # 33 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 34 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 35 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 36 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 37 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 38 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 39 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 40 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 41 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 42 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 43 
   ID_REEH,                ID_NULL,    ID_NULL,      # 44 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 45 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 46 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 47 
   ID_NITSABIM,            ID_NULL,    ID_NULL,      # 48 
   ID_VAYELEH,             ID_NULL,    ID_NULL,      # 49 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 50 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 51 

torahSectionsDIsrael = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_SHEKALIM,ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_ZAHOR,   ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_PEKUDE,  ID_PARAH,     # 22 
   ID_VAYIKRA,             ID_HAHODESH,ID_NULL,      # 23 
   ID_TSAV,                ID_HAGGADOL,ID_NULL,      # 24 
   ID_PESAH_I,             ID_NULL,    ID_NULL,      # 25 
   ID_SHEMINI,             ID_NULL,    ID_NULL,      # 26 
   ID_TAZRIANG,           ID_METSORANG,ID_NULL,      # 27 
   ID_AHAREMOTH,           ID_KEDOSHIM,ID_NULL,      # 28 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 29 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 30 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 31 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 32 
   ID_NASO,                ID_NULL,    ID_NULL,      # 33 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 34 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 35 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 36 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 37 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 38 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 39 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 40 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 41 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 42 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 43 
   ID_REEH,                ID_NULL,    ID_NULL,      # 44 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 45 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 46 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 47 
   ID_NITSABIM,            ID_NULL,    ID_NULL,      # 48 
   ID_VAYELEH,             ID_NULL,    ID_NULL,      # 49 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 50 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 51 

torahSectionsEDiaspora = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_SHEKALIM,ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_ZAHOR,   ID_NULL,      # 20 
   ID_KITISSA,             ID_PARAH,   ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_PEKUDE,  ID_HAHODESH,  # 22 
   ID_VAYIKRA,             ID_NULL,    ID_NULL,      # 23 
   ID_TSAV,                ID_HAGGADOL,ID_NULL,      # 24 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 26 
   ID_SHEMINI,             ID_NULL,    ID_NULL,      # 27 
   ID_TAZRIANG,           ID_METSORANG,ID_NULL,      # 28 
   ID_AHAREMOTH,           ID_KEDOSHIM,ID_NULL,      # 29 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 30 
   ID_BEHAR,            ID_BEHUKKOTHAI,ID_NULL,      # 31 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 32 
   ID_SHAVUOTH_II,         ID_NULL,    ID_NULL,      # 33 
   ID_NASO,                ID_NULL,    ID_NULL,      # 34 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 35 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 36 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 37 
   ID_HUKATH,              ID_BALAK,   ID_NULL,      # 38 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 39 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 40 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 41 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 42 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 43 
   ID_REEH,                ID_NULL,    ID_NULL,      # 44 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 45 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 46 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 47 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 48 
   ID_ROSH_HASHANAH_I,     ID_NULL,    ID_NULL,      # 49 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 50 
   ID_SUCCOTH_I,           ID_NULL,    ID_NULL,      # 51 
   ID_SHEMINI_AZERETH,     ID_NULL,    ID_NULL];     # 52 

torahSectionsEIsrael = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_SHEKALIM,ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_ZAHOR,   ID_NULL,      # 20 
   ID_KITISSA,             ID_PARAH,   ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_PEKUDE,  ID_HAHODESH,  # 22 
   ID_VAYIKRA,             ID_NULL,    ID_NULL,      # 23 
   ID_TSAV,                ID_HAGGADOL,ID_NULL,      # 24 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 26 
   ID_SHEMINI,             ID_NULL,    ID_NULL,      # 27 
   ID_TAZRIANG,           ID_METSORANG,ID_NULL,      # 28 
   ID_AHAREMOTH,           ID_KEDOSHIM,ID_NULL,      # 29 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 30 
   ID_BEHAR,            ID_BEHUKKOTHAI,ID_NULL,      # 31 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 32 
   ID_SHAVUOTH_II,         ID_NULL,    ID_NULL,      # 33 
   ID_NASO,                ID_NULL,    ID_NULL,      # 34 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 35 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 36 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 37 
   ID_HUKATH,              ID_BALAK,   ID_NULL,      # 38 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 39 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 40 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 41 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 42 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 43 
   ID_REEH,                ID_NULL,    ID_NULL,      # 44 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 45 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 46 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 47 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 48 
   ID_ROSH_HASHANAH_I,     ID_NULL,    ID_NULL,      # 49 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 50 
   ID_SUCCOTH_I,           ID_NULL,    ID_NULL,      # 51 
   ID_SHEMINI_AZERETH,     ID_NULL,    ID_NULL];     # 52 

torahSectionsF = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_SHEKALIM,ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_ZAHOR,   ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_PARAH,   ID_NULL,      # 22 
   ID_PEKUDE,              ID_HAHODESH,ID_NULL,      # 23 
   ID_VAYIKRA,             ID_NULL,    ID_NULL,      # 24 
   ID_TSAV,                ID_HAGGADOL,ID_NULL,      # 25 
   ID_PESAH_VII,           ID_NULL,    ID_NULL,      # 26 
   ID_SHEMINI,             ID_NULL,    ID_NULL,      # 27 
   ID_TAZRIANG,           ID_METSORANG,ID_NULL,      # 28 
   ID_AHAREMOTH,           ID_KEDOSHIM,ID_NULL,      # 29 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 30 
   ID_BEHAR,            ID_BEHUKKOTHAI,ID_NULL,      # 31 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 32 
   ID_NASO,                ID_NULL,    ID_NULL,      # 34 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 35 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 36 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 37 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 38 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 39 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 40 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 41 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 42 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 43 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 44 
   ID_REEH,                ID_NULL,    ID_NULL,      # 45 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 46 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 47 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 48 
   ID_NITSABIM,            ID_NULL,    ID_NULL,      # 49 
   ID_VAYELEH,             ID_NULL,    ID_NULL,      # 50 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 51 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 52 

torahSectionsG = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_SHEKALIM,ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_ZAHOR,   ID_NULL,      # 20 
   ID_KITISSA,             ID_PARAH,   ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_PEKUDE,  ID_HAHODESH,  # 22 
   ID_VAYIKRA,             ID_NULL,    ID_NULL,      # 24 
   ID_TSAV,                ID_HAGGADOL,ID_NULL,      # 25 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 26 
   ID_SHEMINI,             ID_NULL,    ID_NULL,      # 27 
   ID_TAZRIANG,           ID_METSORANG,ID_NULL,      # 28 
   ID_AHAREMOTH,           ID_KEDOSHIM,ID_NULL,      # 29 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 30 
   ID_BEHAR,            ID_BEHUKKOTHAI,ID_NULL,      # 31 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 32 
   ID_NASO,                ID_NULL,    ID_NULL,      # 33 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 34 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 35 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 36 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 37 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 38 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 39 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 40 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 41 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 42 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 43 
   ID_REEH,                ID_NULL,    ID_NULL,      # 44 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 45 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 46 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 47 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 48 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 49 
   ID_YOM_KIPPUR,          ID_NULL,    ID_NULL,      # 50 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 51 

torahSectionsHDiaspora = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_SHEKALIM,ID_NULL,      # 22 
   ID_PEKUDE,              ID_NULL,    ID_NULL,      # 23 
   ID_VAYIKRA,             ID_ZAHOR,   ID_NULL,      # 24 
   ID_TSAV,                ID_PARAH,   ID_NULL,      # 25 
   ID_SHEMINI,             ID_HAHODESH,ID_NULL,      # 26 
   ID_TAZRIANG,            ID_NULL,    ID_NULL,      # 27 
   ID_METSORANG,           ID_HAGGADOL,ID_NULL,      # 28 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 29 
   ID_AHAREMOTH,           ID_NULL,    ID_NULL,      # 30 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 31 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 32 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 33 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 34 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 35 
   ID_SHAVUOTH_II,         ID_NULL,    ID_NULL,      # 36 
   ID_NASO,                ID_NULL,    ID_NULL,      # 37 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 38 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 39 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 40 
   ID_HUKATH,              ID_BALAK,   ID_NULL,      # 41 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 42 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 43 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 44 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 45 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 46 
   ID_REEH,                ID_NULL,    ID_NULL,      # 47 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 48 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 49 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 50 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 51 
   ID_ROSH_HASHANAH_I,     ID_NULL,    ID_NULL,      # 52 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 53 
   ID_SUCCOTH_I,           ID_NULL,    ID_NULL,      # 54 
   ID_SHEMINI_AZERETH,     ID_NULL,    ID_NULL];     # 55 

torahSectionsHIsrael = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_SHEKALIM,ID_NULL,      # 22 
   ID_PEKUDE,              ID_NULL,    ID_NULL,      # 23 
   ID_VAYIKRA,             ID_ZAHOR,   ID_NULL,      # 24 
   ID_TSAV,                ID_PARAH,   ID_NULL,      # 25 
   ID_SHEMINI,             ID_HAHODESH,ID_NULL,      # 26 
   ID_TAZRIANG,            ID_NULL,    ID_NULL,      # 27 
   ID_METSORANG,           ID_HAGGADOL,ID_NULL,      # 28 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 29 
   ID_AHAREMOTH,           ID_NULL,    ID_NULL,      # 30 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 31 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 32 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 33 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 34 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 35 
   ID_NASO,                ID_NULL,    ID_NULL,      # 36 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 37 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 38 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 39 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 40 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 41 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 42 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 43 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 44 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 45 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 46 
   ID_REEH,                ID_NULL,    ID_NULL,      # 47 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 48 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 49 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 50 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 51 
   ID_ROSH_HASHANAH_I,     ID_NULL,    ID_NULL,      # 52 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 53 
   ID_SUCCOTH_I,           ID_NULL,    ID_NULL,      # 54 
   ID_SHEMINI_AZERETH,     ID_NULL,    ID_NULL];     # 55 

torahSectionsI = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_NULL,    ID_NULL,      # 22 
   ID_PEKUDE,              ID_SHEKALIM,ID_NULL,      # 23 
   ID_VAYIKRA,             ID_ZAHOR,   ID_NULL,      # 24 
   ID_TSAV,                ID_NULL,    ID_NULL,      # 25 
   ID_SHEMINI,             ID_PARAH,   ID_NULL,      # 26 
   ID_TAZRIANG,            ID_HAHODESH,ID_NULL,      # 27 
   ID_METSORANG,           ID_NULL,    ID_NULL,      # 28 
   ID_AHAREMOTH,           ID_HAGGADOL,ID_NULL,      # 29 
   ID_PESAH_VII,           ID_NULL,    ID_NULL,      # 30 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 31 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 32 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 33 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 34 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 35 
   ID_NASO,                ID_NULL,    ID_NULL,      # 36 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 37 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 38 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 39 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 40 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 41 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 42 
   ID_MATOTH,              ID_NULL,    ID_NULL,      # 43 
   ID_MASEH,               ID_NULL,    ID_NULL,      # 44 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 45 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 46 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 47 
   ID_REEH,                ID_NULL,    ID_NULL,      # 48 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 49 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 50 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 51 
   ID_NITSABIM,            ID_NULL,    ID_NULL,      # 52 
   ID_VAYELEH,             ID_NULL,    ID_NULL,      # 53 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 54 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 55 

torahSectionsJ = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_SHEKALIM,ID_NULL,      # 22 
   ID_PEKUDE,              ID_NULL,    ID_NULL,      # 23 
   ID_VAYIKRA,             ID_ZAHOR,   ID_NULL,      # 24 
   ID_TSAV,                ID_PARAH,   ID_NULL,      # 25 
   ID_SHEMINI,             ID_HAHODESH,ID_NULL,      # 26 
   ID_TAZRIANG,            ID_NULL,    ID_NULL,      # 27 
   ID_METSORANG,           ID_HAGGADOL,ID_NULL,      # 28 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 29 
   ID_AHAREMOTH,           ID_NULL,    ID_NULL,      # 30 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 31 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 32 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 33 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 34 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 35 
   ID_NASO,                ID_NULL,    ID_NULL,      # 36 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 37 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 38 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 39 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 40 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 41 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 42 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 43 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 44 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 45 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 46 
   ID_REEH,                ID_NULL,    ID_NULL,      # 47 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 48 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 49 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 50 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 51 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 52 
   ID_YOM_KIPPUR,          ID_NULL,    ID_NULL,      # 53 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 54 

torahSectionsKDiaspora = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_SHEKALIM,ID_NULL,      # 22 
   ID_PEKUDE,              ID_NULL,    ID_NULL,      # 23 
   ID_VAYIKRA,             ID_ZAHOR,   ID_NULL,      # 24 
   ID_TSAV,                ID_NULL,    ID_NULL,      # 25 
   ID_SHEMINI,             ID_PARAH,   ID_NULL,      # 26 
   ID_TAZRIANG,            ID_HAHODESH,ID_NULL,      # 27 
   ID_METSORANG,           ID_HAGGADOL,ID_NULL,      # 28 
   ID_PESAH_I,             ID_NULL,    ID_NULL,      # 29 
   ID_PESAH_VIII,          ID_NULL,    ID_NULL,      # 30 
   ID_AHAREMOTH,           ID_NULL,    ID_NULL,      # 31 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 32 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 33 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 34 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 35 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 36 
   ID_NASO,                ID_NULL,    ID_NULL,      # 37 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 38 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 39 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 40 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 41 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 42 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 43 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 44 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 45 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 46 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 47 
   ID_REEH,                ID_NULL,    ID_NULL,      # 48 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 49 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 50 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 51 
   ID_NITSABIM,            ID_NULL,    ID_NULL,      # 52 
   ID_VAYELEH,             ID_NULL,    ID_NULL,      # 53 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 54 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 55 

torahSectionsKIsrael = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_SHEKALIM,ID_NULL,      # 22 
   ID_PEKUDE,              ID_NULL,    ID_NULL,      # 23 
   ID_VAYIKRA,             ID_ZAHOR,   ID_NULL,      # 24 
   ID_TSAV,                ID_NULL,    ID_NULL,      # 25 
   ID_SHEMINI,             ID_PARAH,   ID_NULL,      # 26 
   ID_TAZRIANG,            ID_HAHODESH,ID_NULL,      # 27 
   ID_METSORANG,           ID_HAGGADOL,ID_NULL,      # 28 
   ID_PESAH_I,             ID_NULL,    ID_NULL,      # 29 
   ID_AHAREMOTH,           ID_NULL,    ID_NULL,      # 30 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 31 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 32 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 33 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 34 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 35 
   ID_NASO,                ID_NULL,    ID_NULL,      # 36 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 37 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 38 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 39 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 40 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 41 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 42 
   ID_MATOTH,              ID_NULL,    ID_NULL,      # 43 
   ID_MASEH,               ID_NULL,    ID_NULL,      # 44 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 45 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 46 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 47 
   ID_REEH,                ID_NULL,    ID_NULL,      # 48 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 49 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 50 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 51 
   ID_NITSABIM,            ID_NULL,    ID_NULL,      # 52 
   ID_VAYELEH,             ID_NULL,    ID_NULL,      # 53 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 54 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 55 

torahSectionsLDiaspora = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_SHEKALIM,ID_NULL,      # 22 
   ID_PEKUDE,              ID_NULL,    ID_NULL,      # 23 
   ID_VAYIKRA,             ID_ZAHOR,  ID_NULL,      # 24 
   ID_TSAV,                ID_NULL,    ID_NULL,      # 25 
   ID_SHEMINI,             ID_PARAH,   ID_NULL,      # 26 
   ID_TAZRIANG,            ID_HAHODESH,ID_NULL,      # 27 
   ID_METSORANG,           ID_HAGGADOL,ID_NULL,      # 28 
   ID_PESAH_I,             ID_NULL,    ID_NULL,      # 29 
   ID_PESAH_VIII,          ID_NULL,    ID_NULL,      # 30 
   ID_AHAREMOTH,           ID_NULL,    ID_NULL,      # 31 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 32 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 33 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 34 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 35 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 36 
   ID_NASO,                ID_NULL,    ID_NULL,      # 37 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 38 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 39 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 40 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 41 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 42 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 43 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 44 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 45 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 46 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 47 
   ID_REEH,                ID_NULL,    ID_NULL,      # 48 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 49 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 50 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 51 
   ID_NITSABIM,            ID_NULL,    ID_NULL,      # 52 
   ID_VAYELEH,             ID_NULL,    ID_NULL,      # 53 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 54 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 55 

torahSectionsLIsrael = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_SHEKALIM,ID_NULL,      # 22 
   ID_PEKUDE,              ID_NULL,    ID_NULL,      # 23 
   ID_VAYIKRA,             ID_ZAHOR,  ID_NULL,      # 24 
   ID_TSAV,                ID_NULL,    ID_NULL,      # 25 
   ID_SHEMINI,             ID_PARAH,   ID_NULL,      # 26 
   ID_TAZRIANG,            ID_HAHODESH,ID_NULL,      # 27 
   ID_METSORANG,           ID_HAGGADOL,ID_NULL,      # 28 
   ID_PESAH_I,             ID_NULL,    ID_NULL,      # 29 
   ID_AHAREMOTH,           ID_NULL,    ID_NULL,      # 30 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 31 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 32 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 33 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 34 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 35 
   ID_NASO,                ID_NULL,    ID_NULL,      # 36 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 37 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 38 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 39 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 40 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 41 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 42 
   ID_MATOTH,              ID_NULL,    ID_NULL,      # 43 
   ID_MASEH,               ID_NULL,    ID_NULL,      # 44 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 45 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 46 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 47 
   ID_REEH,                ID_NULL,    ID_NULL,      # 48 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 49 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 50 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 51 
   ID_NITSABIM,            ID_NULL,    ID_NULL,      # 52 
   ID_VAYELEH,             ID_NULL,    ID_NULL,      # 53 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 54 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 55 

torahSectionsM = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_NULL,    ID_NULL,      # 22 
   ID_PEKUDE,              ID_SHEKALIM,ID_NULL,      # 23 
   ID_VAYIKRA,             ID_NULL,    ID_NULL,      # 24 
   ID_TSAV,                ID_ZAHOR,   ID_NULL,      # 25 
   ID_SHEMINI,             ID_PARAH,   ID_NULL,      # 26 
   ID_TAZRIANG,            ID_HAHODESH,ID_NULL,      # 27 
   ID_METSORANG,           ID_NULL,    ID_NULL,      # 28 
   ID_AHAREMOTH,           ID_HAGGADOL,ID_NULL,      # 29 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 30 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 31 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 32 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 33 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 34 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 35 
   ID_NASO,                ID_NULL,    ID_NULL,      # 36 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 37 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 38 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 39 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 40 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 41 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 42 
   ID_MATOTH,              ID_NULL,    ID_NULL,      # 43 
   ID_MASEH,               ID_NULL,    ID_NULL,      # 44 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 45 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 46 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 47 
   ID_REEH,                ID_NULL,    ID_NULL,      # 48 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 49 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 50 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 51 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 52 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 53 
   ID_YOM_KIPPUR,          ID_NULL,    ID_NULL,      # 54 
   ID_HOL_HAMOED_SUCCOTH,  ID_NULL,    ID_NULL];     # 55 

torahSectionsNDiaspora = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_SHEKALIM,ID_NULL,      # 22 
   ID_PEKUDE,              ID_NULL,    ID_NULL,      # 23 
   ID_VAYIKRA,             ID_ZAHOR,   ID_NULL,      # 24 
   ID_TSAV,                ID_PARAH,   ID_NULL,      # 25 
   ID_SHEMINI,             ID_HAHODESH,ID_NULL,      # 26 
   ID_TAZRIANG,            ID_NULL,    ID_NULL,      # 27 
   ID_METSORANG,           ID_HAGGADOL,ID_NULL,      # 28 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 29 
   ID_AHAREMOTH,           ID_NULL,    ID_NULL,      # 30 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 31 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 32 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 33 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 34 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 35 
   ID_SHAVUOTH_II,         ID_NULL,    ID_NULL,      # 36 
   ID_NASO,                ID_NULL,    ID_NULL,      # 37 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 38 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 39 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 40 
   ID_HUKATH,              ID_BALAK,   ID_NULL,      # 41 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 42 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 43 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 44 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 45 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 46 
   ID_REEH,                ID_NULL,    ID_NULL,      # 47 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 48 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 49 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 50 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 51 
   ID_ROSH_HASHANAH_I,     ID_NULL,    ID_NULL,      # 52 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 53 
   ID_SUCCOTH_I,           ID_NULL,    ID_NULL,      # 54 
   ID_SHEMINI_AZERETH,     ID_NULL,    ID_NULL];     # 55 

torahSectionsNIsrael = \
  [ID_BERESHITH,           ID_NULL,    ID_NULL,      #  1 
   ID_NOAH,                ID_NULL,    ID_NULL,      #  2 
   ID_LEHLEHA,             ID_NULL,    ID_NULL,      #  3 
   ID_VAYERA,              ID_NULL,    ID_NULL,      #  4 
   ID_HAYESARAH,           ID_NULL,    ID_NULL,      #  5 
   ID_TOLEDOTH,            ID_NULL,    ID_NULL,      #  6 
   ID_VAYETSE,             ID_NULL,    ID_NULL,      #  7 
   ID_VAYISHLAH,           ID_NULL,    ID_NULL,      #  8 
   ID_VAYESHEB,            ID_NULL,    ID_NULL,      #  9 
   ID_MIKKETS,             ID_NULL,    ID_NULL,      # 10 
   ID_VAYIGGASH,           ID_NULL,    ID_NULL,      # 11 
   ID_VAYHEE,              ID_NULL,    ID_NULL,      # 12 
   ID_SHEMOTH,             ID_NULL,    ID_NULL,      # 13 
   ID_VAERA,               ID_NULL,    ID_NULL,      # 14 
   ID_BO,                  ID_NULL,    ID_NULL,      # 15 
   ID_BESHALLAH,           ID_NULL,    ID_NULL,      # 16 
   ID_YITHRO,              ID_NULL,    ID_NULL,      # 17 
   ID_MISHPATIM,           ID_NULL,    ID_NULL,      # 18 
   ID_TERUMAH,             ID_NULL,    ID_NULL,      # 19 
   ID_TETSAVVEH,           ID_NULL,    ID_NULL,      # 20 
   ID_KITISSA,             ID_NULL,    ID_NULL,      # 21 
   ID_VAYAKHEL,            ID_SHEKALIM,ID_NULL,      # 22 
   ID_PEKUDE,              ID_NULL,    ID_NULL,      # 23 
   ID_VAYIKRA,             ID_ZAHOR,   ID_NULL,      # 24 
   ID_TSAV,                ID_PARAH,   ID_NULL,      # 25 
   ID_SHEMINI,             ID_HAHODESH,ID_NULL,      # 26 
   ID_TAZRIANG,            ID_NULL,    ID_NULL,      # 27 
   ID_METSORANG,           ID_HAGGADOL,ID_NULL,      # 28 
   ID_HOL_HAMOED_PESAH,    ID_NULL,    ID_NULL,      # 29 
   ID_AHAREMOTH,           ID_NULL,    ID_NULL,      # 30 
   ID_KEDOSHIM,            ID_NULL,    ID_NULL,      # 31 
   ID_EMOR,                ID_NULL,    ID_NULL,      # 32 
   ID_BEHAR,               ID_NULL,    ID_NULL,      # 33 
   ID_BEHUKKOTHAI,         ID_NULL,    ID_NULL,      # 34 
   ID_BEMIDBAR,            ID_NULL,    ID_NULL,      # 35 
   ID_NASO,                ID_NULL,    ID_NULL,      # 36 
   ID_BEHAALOTEHA,         ID_NULL,    ID_NULL,      # 37 
   ID_SHELAHLEHA,          ID_NULL,    ID_NULL,      # 38 
   ID_KORAH,               ID_NULL,    ID_NULL,      # 39 
   ID_HUKATH,              ID_NULL,    ID_NULL,      # 40 
   ID_BALAK,               ID_NULL,    ID_NULL,      # 41 
   ID_PINHAS,              ID_NULL,    ID_NULL,      # 42 
   ID_MATOTH,              ID_MASEH,   ID_NULL,      # 43 
   ID_DEBARIM,             ID_NULL,    ID_NULL,      # 44 
   ID_VAETHANAN,           ID_NULL,    ID_NULL,      # 45 
   ID_EKEB,                ID_NULL,    ID_NULL,      # 46 
   ID_REEH,                ID_NULL,    ID_NULL,      # 47 
   ID_SHOFETIM,            ID_NULL,    ID_NULL,      # 48 
   ID_KITETSE,             ID_NULL,    ID_NULL,      # 49 
   ID_KITABO,              ID_NULL,    ID_NULL,      # 50 
   ID_NITSABIM,            ID_VAYELEH, ID_NULL,      # 51 
   ID_ROSH_HASHANAH_I,     ID_NULL,    ID_NULL,      # 52 
   ID_HAAZINU,             ID_NULL,    ID_NULL,      # 53 
   ID_SUCCOTH_I,           ID_NULL,    ID_NULL,      # 54 
   ID_SHEMINI_AZERETH,     ID_NULL,    ID_NULL];     # 55 

def torahGetWeekday(absDate):
  wochentag = (int(absDate) + 2) % 7
  return wochentag

def torahHebrewLeapYear(year):
  return date_utils.calendar_util.hebrew_leap(year)

def torahLastMonthOfHebrewYear(year):
  return date_utils.calendar_util.hebrew_year_months(year)

def getYearType(year):
  rhWeekday = torahGetWeekday(date_utils.calendar_util.hebrew_to_jd(year, 7, 1));
  lengthOfYear = int(date_utils.calendar_util.hebrew_to_jd(year+1, 7, 1) - date_utils.calendar_util.hebrew_to_jd(year, 7, 1));
  pesWeekday = torahGetWeekday(date_utils.calendar_util.hebrew_to_jd(year, 1, 15));

  if ((rhWeekday == 1) and (lengthOfYear == 353) and (pesWeekday == 2)):
    return 1;
  if ((rhWeekday == 6) and (lengthOfYear == 353) and (pesWeekday == 0)):
    return 2;
  if ((rhWeekday == 2) and (lengthOfYear == 354) and (pesWeekday == 4)):
    return 3;
  if ((rhWeekday == 4) and (lengthOfYear == 354) and (pesWeekday == 6)):
    return 4;
  if ((rhWeekday == 1) and (lengthOfYear == 355) and (pesWeekday == 4)):
    return 5;
  if ((rhWeekday == 4) and (lengthOfYear == 355) and (pesWeekday == 0)):
    return 6;
  if ((rhWeekday == 6) and (lengthOfYear == 355) and (pesWeekday == 2)):
    return 7;

  if ((rhWeekday == 1) and (lengthOfYear == 383) and (pesWeekday == 4)):
    return 8;
  if ((rhWeekday == 4) and (lengthOfYear == 383) and (pesWeekday == 0)):
    return 9;
  if ((rhWeekday == 6) and (lengthOfYear == 383) and (pesWeekday == 2)):
    return 10;
  if ((rhWeekday == 2) and (lengthOfYear == 384) and (pesWeekday == 6)):
    return 11;
  if ((rhWeekday == 1) and (lengthOfYear == 385) and (pesWeekday == 6)):
    return 12;
  if ((rhWeekday == 4) and (lengthOfYear == 385) and (pesWeekday == 2)):
    return 13;
  if ((rhWeekday == 6) and (lengthOfYear == 385) and (pesWeekday == 4)):
   return 14;

  return 0;

def determineBereshith(year):
  simchatTorah = date_utils.calendar_util.hebrew_to_jd(year, 7, 23);
  while (torahGetWeekday(simchatTorah) != 6):
    simchatTorah += 1;
  return (simchatTorah);

def getTorahSections(hebrewMonth, hebrewDay, hebrewYear, diaspora):
  shuvahDate = date_utils.calendar_util.hebrew_to_jd(hebrewYear, 7, 1)+1;
  while (torahGetWeekday(shuvahDate) != 6):
    shuvahDate += 1;

  torahDate = date_utils.calendar_util.hebrew_to_jd(hebrewYear, hebrewMonth, hebrewDay);
  if (torahGetWeekday(torahDate) == 6):
    bereshithDate = determineBereshith(hebrewYear);
    if (torahDate < bereshithDate):
      referenceYear = hebrewYear-1;
    else:
      referenceYear = hebrewYear;

    yearType = getYearType(referenceYear);
    bereshithDate = determineBereshith(referenceYear);
    torahWeekNo = int(torahDate-bereshithDate)/7;

    returnTorahSection = "";
    idTorah1 = ID_NULL;
    idTorah2 = ID_NULL;
    idTorah3 = ID_NULL;
#
# allgemein: A, B, F, G, I, J, M
# Israel/Diaspora: C, D, E, H, K, L, N
#

    if (yearType == 1): # A
      idTorah1 = torahSectionsA[torahWeekNo * 3 + 0];
      idTorah2 = torahSectionsA[torahWeekNo * 3 + 1];
      idTorah3 = torahSectionsA[torahWeekNo * 3 + 2];
    if (yearType == 2): # B
      idTorah1 = torahSectionsB[torahWeekNo * 3 + 0];
      idTorah2 = torahSectionsB[torahWeekNo * 3 + 1];
      idTorah3 = torahSectionsB[torahWeekNo * 3 + 2];
    if (yearType == 3): # C
      if diaspora:
        idTorah1 = torahSectionsCDiaspora[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsCDiaspora[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsCDiaspora[torahWeekNo * 3 + 2];
      else:
        idTorah1 = torahSectionsCIsrael[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsCIsrael[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsCIsrael[torahWeekNo * 3 + 2];
    if (yearType == 4): # D
      if diaspora:
        idTorah1 = torahSectionsDDiaspora[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsDDiaspora[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsDDiaspora[torahWeekNo * 3 + 2];
      else:
        idTorah1 = torahSectionsDIsrael[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsDIsrael[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsDIsrael[torahWeekNo * 3 + 2];
    if (yearType == 5): # E
      if diaspora:
        idTorah1 = torahSectionsEDiaspora[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsEDiaspora[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsEDiaspora[torahWeekNo * 3 + 2];
      else:
        idTorah1 = torahSectionsEIsrael[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsEIsrael[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsEIsrael[torahWeekNo * 3 + 2];
    if (yearType == 6): # F
      idTorah1 = torahSectionsF[torahWeekNo * 3 + 0];
      idTorah2 = torahSectionsF[torahWeekNo * 3 + 1];
      idTorah3 = torahSectionsF[torahWeekNo * 3 + 2];
    if (yearType == 7): # G
      idTorah1 = torahSectionsG[torahWeekNo * 3 + 0];
      idTorah2 = torahSectionsG[torahWeekNo * 3 + 1];
      idTorah3 = torahSectionsG[torahWeekNo * 3 + 2];
    if (yearType == 8): # H
      if diaspora:
        idTorah1 = torahSectionsHDiaspora[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsHDiaspora[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsHDiaspora[torahWeekNo * 3 + 2];
      else:
        idTorah1 = torahSectionsHIsrael[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsHIsrael[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsHIsrael[torahWeekNo * 3 + 2];
    if (yearType == 9): # I
      idTorah1 = torahSectionsI[torahWeekNo * 3 + 0];
      idTorah2 = torahSectionsI[torahWeekNo * 3 + 1];
      idTorah3 = torahSectionsI[torahWeekNo * 3 + 2];
    if (yearType == 10): # J
      idTorah1 = torahSectionsJ[torahWeekNo * 3 + 0];
      idTorah2 = torahSectionsJ[torahWeekNo * 3 + 1];
      idTorah3 = torahSectionsJ[torahWeekNo * 3 + 2];
    if (yearType == 11): # K
      if (diaspora):
        idTorah1 = torahSectionsKDiaspora[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsKDiaspora[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsKDiaspora[torahWeekNo * 3 + 2];
      else:
        idTorah1 = torahSectionsKIsrael[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsKIsrael[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsKIsrael[torahWeekNo * 3 + 2];
    if (yearType == 12): # L
      if (diaspora):
        idTorah1 = torahSectionsLDiaspora[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsLDiaspora[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsLDiaspora[torahWeekNo * 3 + 2];
      else:
        idTorah1 = torahSectionsLIsrael[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsLIsrael[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsLIsrael[torahWeekNo * 3 + 2];
    if (yearType == 13): # M
      idTorah1 = torahSectionsM[torahWeekNo * 3 + 0];
      idTorah2 = torahSectionsM[torahWeekNo * 3 + 1];
      idTorah3 = torahSectionsM[torahWeekNo * 3 + 2];
    if (yearType == 14): # N
      if diaspora:
        idTorah1 = torahSectionsNDiaspora[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsNDiaspora[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsNDiaspora[torahWeekNo * 3 + 2];
      else:
        idTorah1 = torahSectionsNIsrael[torahWeekNo * 3 + 0];
        idTorah2 = torahSectionsNIsrael[torahWeekNo * 3 + 1];
        idTorah3 = torahSectionsNIsrael[torahWeekNo * 3 + 2];

    if (idTorah1 != ID_NULL):
      torahSection = getTorahSectionName(idTorah1);
      if (torahSection != ""):
	if (returnTorahSection != ""):
	  returnTorahSection = returnTorahSection + ", ";
	returnTorahSection = returnTorahSection + torahSection;
    if (idTorah2 != ID_NULL):
      torahSection = getTorahSectionName(idTorah2);
      if (torahSection != ""):
	if (returnTorahSection != ""):
	  returnTorahSection = returnTorahSection + ", ";
	returnTorahSection = returnTorahSection + torahSection;
    if (idTorah3 != ID_NULL):
      torahSection = getTorahSectionName(idTorah3);
      if (torahSection != ""):
	if (returnTorahSection != ""):
	  returnTorahSection = returnTorahSection + ", ";
	returnTorahSection = returnTorahSection + torahSection;

    if (torahDate == shuvahDate):
      if (returnTorahSection != ""):
	returnTorahSection = returnTorahSection + ", ";
      returnTorahSection = returnTorahSection + getTorahSectionName(ID_SHUVA);

    return (returnTorahSection);
  else:
    return "";

def getTorahSectionName(section):
  if (section == ID_BERESHITH):
    return "Bereshith";
  if (section == ID_NOAH):
    return "Noah";
  if (section == ID_LEHLEHA):
    return "Le'h Leha";
  if (section == ID_VAYERA):
    return "Vayera";
  if (section == ID_HAYESARAH):
    return "Haye Sarah";
  if (section == ID_TOLEDOTH):
    return "Toledoth";
  if (section == ID_VAYETSE):
    return "Vayetse";
  if (section == ID_VAYISHLAH):
    return "Vayishlah";
  if (section == ID_VAYESHEB):
    return "Vayesheb";
  if (section == ID_MIKKETS):
    return "Mikkets";
  if (section == ID_VAYIGGASH):
    return "Vayiggash";
  if (section == ID_VAYHEE):
    return "Vayhee";
  if (section == ID_SHEMOTH):
    return "Shemoth";
  if (section == ID_VAERA):
    return "Vaera";
  if (section == ID_BO):
    return "Bo";
  if (section == ID_BESHALLAH):
    return "Beshallah, Shabbat Shirah";
  if (section == ID_YITHRO):
    return "Yithro";
  if (section == ID_MISHPATIM):
    return "Mishpatim";
  if (section == ID_TERUMAH):
    return "Terumah";
  if (section == ID_TETSAVVEH):
    return "Tetsavveh";
  if (section == ID_KITISSA):
    return "Ki Tissa";
  if (section == ID_VAYAKHEL):
    return "Vayakhel";
  if (section == ID_PEKUDE):
    return "Pekude";
  if (section == ID_VAYIKRA):
    return "Vayikra";
  if (section == ID_TSAV):
    return "Tsav";
  if (section == ID_SHEMINI):
    return "Shemini";
  if (section == ID_TAZRIANG):
    return "Tazria";
  if (section == ID_METSORANG):
    return "Metsora";
  if (section == ID_AHAREMOTH):
    return "Aharemoth";
  if (section == ID_KEDOSHIM):
    return "Kedoshim";
  if (section == ID_EMOR):
    return "Emor";
  if (section == ID_BEHAR):
    return "Behar";
  if (section == ID_BEHUKKOTHAI):
    return "Behukkothai";
  if (section == ID_BEMIDBAR):
    return "Bemidbar";
  if (section == ID_NASO):
    return "Naso";
  if (section == ID_BEHAALOTEHA):
    return "Behaaloteha";
  if (section == ID_SHELAHLEHA):
    return "Shelah Leha";
  if (section == ID_KORAH):
    return "Korah";
  if (section == ID_HUKATH):
    return "Hukath";
  if (section == ID_BALAK):
    return "Balak";
  if (section == ID_PINHAS):
    return "Pinhas";
  if (section == ID_MATOTH):
    return "Matoth";
  if (section == ID_MASEH):
    return "Maseh";
  if (section == ID_DEBARIM):
    return "Debarim, Shabbat Hazon";
  if (section == ID_VAETHANAN):
    return "Vaethanan, Shabbat Nahamu";
  if (section == ID_EKEB):
    return "Ekeb";
  if (section == ID_REEH):
    return "Reeh";
  if (section == ID_SHOFETIM):
    return "Shofetim";
  if (section == ID_KITETSE):
    return "Ki Tetse";
  if (section == ID_KITABO):
    return "Ki Tabo";
  if (section == ID_NITSABIM):
    return "Nitsabim";
  if (section == ID_VAYELEH):
    return "Vayeleh";
  if (section == ID_HAAZINU):
    return "Haazinu";

  if (section == ID_SHEKALIM):
    return "Shabbat Shekalim";
  if (section == ID_ZAHOR):
    return "Shabbat Za'hor";
  if (section == ID_PARAH):
    return "Shabbat Parah";
  if (section == ID_HAHODESH):
    return "Shabbat Hahodesh";
  if (section == ID_SHUVA):
    return "Shabbat Shuva";

  return "";

Example of use: file sample.py

import torah
import sys

if len(sys.argv) == 5:
  day = int(sys.argv[1])
  month = int(sys.argv[2])
  year = int(sys.argv[3])
  if sys.argv[4] == "y":
    diaspora = True
  else:
    diaspora = False
  str = torah.getTorahSections(month, day, year, diaspora)
  if str != "":
    print "Torah section(s): " + str
  else:
    print "No torah section(s) on that day"
else:
  print "Syntax: python sample.py <Day> <Month> <Year> <Diaspora flag: y = Diaspora, n = Israel>"

Valid XHTML 1.1