From d17542d63cc51e407fe39c3f1c346085b63e32d7 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 5 Jun 2014 03:44:10 +0200 Subject: add solstice prediction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/solar.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/solar.py b/src/solar.py index aceacfc..028330c 100644 --- a/src/solar.py +++ b/src/solar.py @@ -513,6 +513,23 @@ def past_equinox(t = None): return future_past_equinox(0.01 / -2000, t) +# TODO document +def future_past_solstice(delta, t = None): + e = 0.0001 + fun = lambda t : (solar_declination(t - e) - solar_declination(t + e)) / 2 + return solar_prediction(delta, 0, fun, t = t) + + +# TODO document +def future_solstice(t = None): + return future_past_solstice(0.01 / 2000, t) + + +# TODO document +def past_solstice(t = None): + return future_past_solstice(0.01 / -2000, t) + + def future_past_elevation(delta, latitude, longitude, elevation, t = None): ''' Predict the time point of the next or previous time the Sun reaches or reached a specific elevation @@ -574,3 +591,8 @@ def sunrise_equation(latitude, longitude, t = None): sunrise = 2 * solar_transit - sunset return (julian_day_to_julian_centuries(sunset), julian_day_to_julian_centuries(sunrise)) + +def ptime(t): + import datetime + print(str(datetime.datetime.fromtimestamp(int(julian_centuries_to_epoch(t))))) + -- cgit v1.2.3-70-g09d2