def _next_fall_equinox(jd):
    '''Return the julian day count of the previous fall equinox.'''
    y, _, _ = gregorian.from_jd(jd)
    eqx = Sun.get_equinox_solstice(y, "autumn").jde()
    if eqx < jd:
        eqx = Sun.get_equinox_solstice(y + 1, "autumn").jde()

    return eqx
Exemple #2
0
def gregorian_day_of_nawruz(year):

    if year == 2059:
        return 20

    # get time of spring equinox
    equinox = Sun.get_equinox_solstice(year, "spring")

    # get sunset times in Tehran
    latitude = Angle(35.6944)
    longitude = Angle(51.4215)

    # get time of sunset in Tehran
    days = [19, 20, 21]
    sunsets = list(
        map(lambda x: Epoch(year, 3, x).rise_set(latitude, longitude)[1],
            days))

    # compare
    if equinox < sunsets[1]:
        if equinox < sunsets[0]:
            return 19
        else:
            return 20
    else:
        if equinox < sunsets[2]:
            return 21
        else:
            return 22
def equinox_jd(gyear):
    """Calculate Julian day during which the March equinox, reckoned from the
    Tehran meridian, occurred for a given Gregorian year."""
    mean_jd = Sun.get_equinox_solstice(gyear, target='spring')
    deltat_jd = mean_jd - Epoch.tt2ut(gyear, 3) / (24 * 60 * 60.)
    # Apparent JD in universal time
    apparent_jd = deltat_jd + (Sun.equation_of_time(deltat_jd)[0] / (24 * 60.))
    # Correct for meridian of Tehran + 52.5 degrees
    return floor(apparent_jd.jde() + (52.5 / 360))
Exemple #4
0
def test_sun_get_equinox_solstice():
    """Tests the get_equinox_solstice() method of Sun class"""

    epoch = Sun.get_equinox_solstice(1962, target="summer")
    y, m, d, h, mi, s = epoch.get_full_date()
    st = "{}/{}/{} {}:{}:{}".format(y, m, d, h, mi, round(s, 0))

    assert st == "1962/6/21 21:24:42.0", \
        "ERROR: 1st get_equinox_solstice() test, time stamp doesn't match"
Exemple #5
0
def gregorian_nawruz(year):
    '''
        Return Nawruz in the Gregorian calendar.
        Returns a tuple (month, day), where month is always 3
    '''
    if year == 2059:
        return 3, 20

    # Timestamp of spring equinox.
    equinox = Sun.get_equinox_solstice(year, "spring")

    # Get times of sunsets in Tehran near vernal equinox.
    x, y = Angle(TEHRAN[0]), Angle(TEHRAN[1])
    days = trunc(equinox.get_date()[2]), ceil(equinox.get_date()[2])

    for day in days:
        sunset = Epoch(year, 3, day).rise_set(y, x)[1]
        if sunset > equinox:
            return 3, day