def declination(cls, tee, beta, lam): """Return declination at moment UT tee of object at longitude 'lam' and latitude 'beta'.""" varepsilon = cls.obliquity(tee) return arcsin_degrees( (sin_degrees(beta) * cos_degrees(varepsilon)) + (cos_degrees(beta) * sin_degrees(varepsilon) * sin_degrees(lam)))
def approx_moment_of_depression(self, tee, alpha, early): """Return the moment in local time near tee when depression angle of sun is alpha (negative if above horizon) at location; early is true when MORNING event is sought and false for EVENING. Raise VlueError if depression angle is not reached.""" ttry = self.sine_offset(tee, alpha) date = Clock.fixed_from_moment(tee) if alpha >= 0: if early: alt = date else: alt = date + 1 else: alt = date + Clock.days_from_hours(12) if abs(ttry) > 1: value = self.sine_offset(alt, alpha) else: value = ttry if abs(value) <= 1: temp = -1 if early else 1 temp *= mod(Clock.days_from_hours(12) + arcsin_degrees(value) / 360, 1) - Clock.days_from_hours(6) temp += date + Clock.days_from_hours(12) return self.local_from_apparent(temp) else: raise ValueError("Depression angle not reached")
def lunar_parallax(self, tee): """Return the parallax of moon at moment, tee, at location, location. Adapted from "Astronomical Algorithms" by Jean Meeus, Willmann_Bell, Inc., 1998.""" geo = self.lunar_altitude(tee) Delta = Lunar.lunar_distance(tee) alt = 6378140 / Delta arg = alt * cos_degrees(geo) return arcsin_degrees(arg)
def lunar_altitude(self, tee): """Return the geocentric altitude of moon at moment, tee, at location, location, as a small positive/negative angle in degrees, ignoring parallax and refraction. Adapted from 'Astronomical Algorithms' by Jean Meeus, Willmann_Bell, Inc., 1998.""" lamb = Lunar.lunar_longitude(tee) beta = Lunar.lunar_latitude(tee) alpha = Astro.right_ascension(tee, beta, lamb) delta = Astro.declination(tee, beta, lamb) theta0 = Astro.sidereal_from_moment(tee) cap_H = mod(theta0 + self.longitude - alpha, 360) altitude = arcsin_degrees( (sin_degrees(self.latitude) * sin_degrees(delta)) + (cos_degrees(self.latitude) * cos_degrees(delta) * cos_degrees(cap_H))) return mod(altitude + 180, 360) - 180