def hindu_solar_longitude_at_or_after(lam, tee): """Return the moment of the first time at or after moment, tee when Hindu solar longitude will be lam degrees.""" tau = tee + (HinduSolarDate.SIDEREAL_YEAR * (1 / 360) * mod(lam - HinduDate.solar_longitude(tee), 360)) a = max(tee, tau - 5) b = tau +5 return invert_angular(HinduDate.solar_longitude, lam, a, b)
def lunar_day_at_or_after(cls, k, tee): """Return the time lunar_day (tithi) number, k, begins at or after moment, tee. k can be fractional (for karanas).""" phase = (k - 1) * 12 tau = tee + ((1/360) * mod(phase - cls.lunar_phase(tee), 360) * cls.SYNODIC_MONTH) a = max(tee, tau - 2) b = tau + 2 return invert_angular(cls.lunar_phase, phase, a, b)
def solar_longitude_after(cls, lam, tee): """Return the moment UT of the first time at or after moment, tee, when the solar longitude will be lam degrees.""" rate = cls.MEAN_TROPICAL_YEAR / 360 tau = tee + rate * mod(lam - cls.solar_longitude(tee), 360) a = max(tee, tau - 5) b = tau + 5 return invert_angular(cls.solar_longitude, lam, a, b)
def lunar_phase_at_or_after(cls, phi, tee): """Return the moment UT of the next time at or after moment, tee, when the lunar_phase is phi degrees.""" tau = (tee + (cls.MEAN_SYNODIC_MONTH * (1/360) * mod(phi - cls.lunar_phase(tee), 360))) a = max(tee, tau - 2) b = tau + 2 return invert_angular(cls.lunar_phase, phi, a, b)
def lunar_phase_at_or_before(cls, phi, tee): """Return the moment UT of the last time at or before moment, tee, when the lunar_phase was phi degrees.""" tau = (tee - (cls.MEAN_SYNODIC_MONTH * (1/360) * mod(cls.lunar_phase(tee) - phi, 360))) a = tau - 2 b = min(tee, tau +2) return invert_angular(cls.lunar_phase, phi, a, b)