Example #1
0
 def minor_solar_term_on_or_after(cls, ordinal):
     """Return moment (in Beijing) of the first Chinese minor solar
     term (jieqi) on or after ordinal date, 'ordinal'.  The minor terms
     begin when the sun's longitude is an odd multiple of 15 degrees."""
     s = solar_longitude(cls.midnight(ordinal))
     l = (30 * int(math.ceil((s - 15) / 30)) + 15) % 360
     return cls.solar_longitude_on_or_after(l, ordinal)
Example #2
0
 def new_year_on_or_before(cls, ordinal):
     """Return ordinal date of Future Bahai New Year on or
     before ordinal date."""
     approx = estimate_prior_solar_longitude(Season.SPRING,
                                             cls.sunset_in_haifa(ordinal))
     return next_int(
         int(math.floor(approx)) - 1, lambda day: solar_longitude(
             cls.sunset_in_haifa(day)) <= Season.SPRING + 2)
Example #3
0
 def winter_solstice_on_or_before(cls, ordinal):
     """Return ordinal date, in the Chinese zone, of winter solstice
     on or before ordinal date, 'ordinal'."""
     midnight_tomorrow = cls.midnight(ordinal + 1)
     approx = estimate_prior_solar_longitude(Season.WINTER,
                                             midnight_tomorrow)
     return next_int(
         int(math.floor(approx)) - 1,
         lambda day: Season.WINTER < solar_longitude(cls.midnight(1 + day)))
 def sine_offset(self, local_time, alpha):
     """Return sine of angle between position of sun at 
     local time tee and when its depression is alpha at location, location.
     Out of range when it does not occur."""
     phi = self.latitude
     tee_prime = self.universal_from_local(local_time)
     delta = declination(tee_prime, mpf(0), solar_longitude(tee_prime))
     return ((tan_degrees(phi) * tan_degrees(delta)) +
             (sin_degrees(alpha) / (cos_degrees(delta) *
                                    cos_degrees(phi))))
def asr(date, location):
    """Return standard time of asr on fixed date, date,
    at location, location."""
    noon = location.universal_from_standard(location.midday(date))
    phi = location.latitude
    delta = declination(noon, 0, solar_longitude(noon))
    altitude = delta - phi - 90
    h = arctan_degrees(tan_degrees(altitude), 2 * tan_degrees(altitude) + 1)
    # For Shafii use instead:
    # tan_degrees(altitude) + 1)
    return location.dusk(date, -h)
Example #6
0
def lunar_phase(tee):
    """Return the lunar phase, as an angle in degrees, at moment tee.
    An angle of 0 means a new moon, 90 degrees means the
    first quarter, 180 means a full moon, and 270 degrees
    means the last quarter."""
    phi = (lunar_longitude(tee) - solar_longitude(tee)) % 360
    t0 = nth_new_moon(0)
    n = iround((tee - t0) / MEAN_SYNODIC_MONTH)
    phi_prime = 360 * (((tee - nth_new_moon(n)) / MEAN_SYNODIC_MONTH) % 1)
    if abs(phi - phi_prime) > 180:
        return phi_prime
    else:
        return phi
Example #7
0
def sidereal_solar_longitude(tee):
    """Return sidereal solar longitude at moment, tee."""
    return (solar_longitude(tee) - precession(tee) + SIDEREAL_START) % 360
Example #8
0
def ayanamsha(tee):
    """Return the difference between tropical and sidereal solar longitude."""
    return solar_longitude(tee) - sidereal_solar_longitude(tee)
 def new_year_on_or_before(cls, ordinal):
     """Return ordinal date of French Revolutionary New Year on or
        before ordinal, ordinal."""
     approx = estimate_prior_solar_longitude(Season.AUTUMN, cls.midnight_in_paris(ordinal))
     return next_int(ifloor(approx) - 1, lambda day: Season.AUTUMN <= solar_longitude(cls.midnight_in_paris(day)))
Example #10
0
 def major_solar_term(cls, ordinal):
     """Return last Chinese major solar term (zhongqi) before
     ordinal date, 'ordinal'."""
     s = solar_longitude(
         cls.location(ordinal).universal_from_standard(ordinal))
     return amod(2 + int(math.floor(int(s) / 30)), 12)
Example #11
0
 def current_minor_solar_term(cls, ordinal):
     """Return last Chinese minor solar term (jieqi) before date, 'ordinal'."""
     s = solar_longitude(
         cls.location(ordinal).universal_from_standard(ordinal))
     return amod(3 + int(math.floor((s - 15) / 30)), 12)
Example #12
0
 def new_year_on_or_before(cls, date):
     """Return the ordinal date of Astronomical Persian New Year on or
     before ordinal date, ordinal."""
     approx = estimate_prior_solar_longitude(Season.SPRING, cls.midday_in_tehran(date))
     return next_int(int(math.floor(approx)) - 1, lambda day: (solar_longitude(cls.midday_in_tehran(day)) <= (Season.SPRING + 2)))