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 direction(self, focus): """Return the angle (clockwise from North) to face focus when standing in location, location. Subject to errors near focus and its antipode.""" y = sin_degrees(focus.longitude - self.longitude) x = ((cos_degrees(self.latitude) * tan_degrees(focus.latitude)) - (sin_degrees(self.latitude) * cos_degrees(self.longitude - focus.longitude))) if x == y == 0 or focus.latitude == 90: return 0 elif focus.latitude == -90: return 180 else: return arctan_degrees(y, x)
def equation_of_time(cls, tee): """Return the equation of time (as fraction of day) for moment, tee. Adapted from "Astronomical Algorithms" by Jean Meeus, Willmann_Bell, Inc., 1991.""" c = cls.julian_centuries(tee) lamb = poly(c, [mpf(280.46645), mpf(36000.76983), mpf(0.0003032)]) anomaly = poly(c, [mpf(357.52910), mpf(35999.05030), mpf(-0.0001559), mpf(-0.00000048)]) eccentricity = poly(c, [mpf(0.016708617), mpf(-0.000042037), mpf(-0.0000001236)]) varepsilon = cls.obliquity(tee) y = pow(tan_degrees(varepsilon / 2), 2) equation = ((1/2 / pi) * (y * sin_degrees(2 * lamb) + -2 * eccentricity * sin_degrees(anomaly) + (4 * eccentricity * y * sin_degrees(anomaly) * cos_degrees(2 * lamb)) + -0.5 * y * y * sin_degrees(4 * lamb) + -1.25 * eccentricity * eccentricity * sin_degrees(2 * anomaly))) return signum(equation) * min(abs(equation), Clock.days_from_hours(mpf(12)))
def right_ascension(cls, tee, beta, lam): """Return right ascension at moment UT 'tee' of object at latitude 'lam' and longitude 'beta'.""" varepsilon = cls.obliquity(tee) return arctan_degrees((sin_degrees(lam) * cos_degrees(varepsilon)) - (tan_degrees(beta) * sin_degrees(varepsilon)), cos_degrees(lam))