def minor_solar_term_on_or_after(cls, fixed_date): """Return moment (in Beijing) of the first Chinese minor solar term (jieqi) on or after fixed date, 'fixed_date'. The minor terms begin when the sun's longitude is an odd multiple of 15 degrees.""" s = Solar.solar_longitude(cls.midnight(fixed_date)) l = mod(30 * iceiling((s - 15) / 30) + 15, 360) return cls.solar_longitude_on_or_after(l, fixed_date)
def major_solar_term_on_or_after(cls, fixed_date): """Return moment (in Beijing) of the first Chinese major solar term (zhongqi) on or after fixed date, 'fixed_date'. The major terms begin when the sun's longitude is a multiple of 30 degrees.""" s = Solar.solar_longitude(cls.midnight(fixed_date)) l = mod(30 * iceiling(s / 30), 360) return cls.solar_longitude_on_or_after(l, fixed_date)
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 = Astro.declination(tee_prime, mpf(0), Solar.solar_longitude(tee_prime)) return ((tan_degrees(phi) * tan_degrees(delta)) + (sin_degrees(alpha) / (cos_degrees(delta) * cos_degrees(phi))))
def lunar_phase(cls, 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 = mod(cls.lunar_longitude(tee) - Solar.solar_longitude(tee), 360) t0 = cls.nth_new_moon(0) n = iround((tee - t0) / cls.MEAN_SYNODIC_MONTH) phi_prime = (360 * mod((tee - cls.nth_new_moon(n)) / cls.MEAN_SYNODIC_MONTH, 1)) if abs(phi - phi_prime) > 180: return phi_prime else: return phi
def new_year_on_or_before(cls, fixed_date): """Return fixed date of Future Bahai New Year on or before fixed date, 'fixed_date'.""" approx = Solar.estimate_prior_solar_longitude(Astro.SPRING, cls.sunset_in_haifa(fixed_date)) return next_int(ifloor(approx) - 1, lambda day: Solar.solar_longitude(cls.sunset_in_haifa(day)) <= Astro.SPRING + 2)
def sidereal_solar_longitude(tee): """Return sidereal solar longitude at moment, tee.""" return mod(Solar.solar_longitude(tee) - Astro.precession(tee) + SIDEREAL_START, 360)
def ayanamsha(tee): """Return the difference between tropical and sidereal solar longitude.""" return Solar.solar_longitude(tee) - sidereal_solar_longitude(tee)
def new_year_on_or_before(cls, date): """Return the fixed date of Astronomical Persian New Year on or before fixed date, date.""" approx = Solar.estimate_prior_solar_longitude(Astro.SPRING, cls.midday_in_tehran(date)) return next_int(ifloor(approx) - 1, lambda day: (Solar.solar_longitude(cls.midday_in_tehran(day)) <= (Astro.SPRING + 2)))
def current_minor_solar_term(cls, fixed_date): """Return last Chinese minor solar term (jieqi) before date, 'fixed_date'.""" s = Solar.solar_longitude(cls.location(fixed_date).universal_from_standard(fixed_date)) return amod(3 + quotient(s - 15, 30), 12)
def major_solar_term(cls, fixed_date): """Return last Chinese major solar term (zhongqi) before fixed date, 'fixed_date'.""" s = Solar.solar_longitude(cls.location(fixed_date).universal_from_standard(fixed_date)) return amod(2 + quotient(int(s), 30), 12)
def winter_solstice_on_or_before(cls, fixed_date): """Return fixed date, in the Chinese zone, of winter solstice on or before fixed date, 'fixed_date'.""" approx = Solar.estimate_prior_solar_longitude(Astro.WINTER, cls.midnight(fixed_date + 1)) return next_int(ifloor(approx) - 1, lambda day: Astro.WINTER < Solar.solar_longitude(cls.midnight(1 + day)))
def new_year_on_or_before(cls, date): """Return fixed date of French Revolutionary New Year on or before fixed date, date.""" approx = Solar.estimate_prior_solar_longitude(Astro.AUTUMN, cls.midnight_in_paris(date)) return next_int(ifloor(approx) - 1, lambda day: Astro.AUTUMN <= Solar.solar_longitude(cls.midnight_in_paris(day)))