예제 #1
0
def julian_easter(year):
    easter_data = easter(julian_year(year))
    presumptive_easter = julian_to_jd((year, ) + easter_data['easter'])
    equinox = julian_to_jd((year, ) + easter_data['equinox'])
    new_moon = julian_to_jd((year, ) + easter_data['new_moon'])
    passover_begins = hebrew.pesach_jd(hebrew.ad_to_am_at_pesach(year))

    easter_day = presumptive_easter
    needed_passover_correction = False
    while (passover_begins > presumptive_easter):
        needed_passover_correction = True
        easter_day += 7

    return {
            'julian_easter' : easter_day,
            'julian_uncorrected_easter' : presumptive_easter,
            'julian_equinox' : equinox,
            'julian_new_moon' : new_moon,
            'julian_full_moon' : new_moon + 13,
            'julian_passover_correction' : needed_passover_correction,
            'passover' : passover_begins,
            'passover_prep' : passover_begins - 1,
            'nissan' : passover_begins - 14
            }
예제 #2
0
def interleave(year):

    start_date = computus.gregorian_to_jd((year, 3, 1))
    end_date = computus.gregorian_to_jd((year, 5, 31))

    print 'start ' + str(start_date) + '<br>'
    print 'end ' + str(end_date) + '<br>'

    julian = julian_calendar(year)
    gregorian = gregorian_calendar(year)
    hebrew_cal = hebrew_calendar(hebrew.ad_to_am_at_pesach(year))
    compendium = easter_compendium(year)

    i_julian = 0
    i_hebrew = 0
    i = 0

    while julian[i_julian][0] != start_date: i_julian += 1
    while gregorian[i][0] != start_date: i += 1
    while hebrew_cal[i_hebrew][0] != start_date: i_hebrew += 1
    offset = i_julian - i
    hebrew_offset = i_hebrew - i

    # Find Sunday.
    while gregorian[i][3] != 0: i += 1

    prev = str(year - 1)
    next = str(year + 1)

    print """
<div align="center">
<a href=\"""" + prev + """">&lt;&lt; prev</a>
&nbsp;&nbsp;&nbsp;
<a href=\"""" + next + """">next &gt;&gt;</a>
<table border="1" cellspacing="0">
<tr>
<th width="100">Sunday</th>
<th width="100">Monday</th>
<th width="100">Tuesday</th>
<th width="100">Wednesday</th>
<th width="100">Thursday</th>
<th width="100">Friday</th>
<th width="100">Saturday</th>
"""
    done = False
    while not done:
        if gregorian[i][3] == 0:
            print '</tr>'
            print '<tr>'
        print '<td height="100" valign="top">'
        jd = gregorian[i][0]
        print str(jd) + '<br>'
        if jd == end_date:
            done = True
            print 'Done!<br>'
        print 'G',
        print_calendar_entry(gregorian[i])
        print '<br>'
        print 'J',
        print_calendar_entry(julian[i + offset])
        print '<br>'
        print 'H',
        print_hebrew_calendar_entry(
                hebrew_cal[i + hebrew_offset], gregorian[i][3])
        print '<br>'
        annotations = consult_compendium(compendium, jd)
        j_easter = False
        j_pre_easter = False
        for a in annotations:
            if a == 'gregorian_equinox': print 'Equinox (W)'
            elif a == 'gregorian_full_moon': print 'Full Moon (W)'
            elif a == 'gregorian_easter': print 'Easter (W)'
            elif a == 'julian_equinox': print 'Equinox (E)'
            elif a == 'julian_full_moon': print 'Full Moon (E)'
            elif a == 'julian_easter':
                print 'Easter (E)'
                j_easter = True
            elif a == 'julian_uncorrected_easter': j_pre_easter = True
            elif a == 'passover': print 'Passover'
            elif a == 'passover_prep': print 'Full Moon (H)'
            if j_pre_easter and not j_easter: print 'Not Easter (E)'
        print '</td>'
        i += 1