summaryrefslogtreecommitdiffstats
path: root/src/solar.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-05 03:44:10 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-05 03:44:10 +0200
commitd17542d63cc51e407fe39c3f1c346085b63e32d7 (patch)
tree8b16e7bbfebd368eb66106ca301b51c3e9652065 /src/solar.py
parentadd solar_prediction and use it for future_past_equinox and future_past_elevation (diff)
downloadblueshift-d17542d63cc51e407fe39c3f1c346085b63e32d7.tar.gz
blueshift-d17542d63cc51e407fe39c3f1c346085b63e32d7.tar.bz2
blueshift-d17542d63cc51e407fe39c3f1c346085b63e32d7.tar.xz
add solstice prediction
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/solar.py')
-rw-r--r--src/solar.py22
1 files changed, 22 insertions, 0 deletions
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)))))
+