summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-05 02:28:59 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-05 02:28:59 +0200
commit4d0be4101a020ed659ba1fd233b0ea0c89546f00 (patch)
tree26b001e50174398997ac255c76ad74e0c820bc40 /src
parentfix have_sunrise_and_sunset (diff)
downloadblueshift-4d0be4101a020ed659ba1fd233b0ea0c89546f00.tar.gz
blueshift-4d0be4101a020ed659ba1fd233b0ea0c89546f00.tar.bz2
blueshift-4d0be4101a020ed659ba1fd233b0ea0c89546f00.tar.xz
add is_summer and is_winter
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/solar.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/solar.py b/src/solar.py
index 03cb7ce..55a325a 100644
--- a/src/solar.py
+++ b/src/solar.py
@@ -448,6 +448,20 @@ def have_sunrise_and_sunset(latitude, t = None):
return -90 - d < latitude < 90 + d ## Northern winter
+# TODO document and demo
+def is_summer(latitude, t = None):
+ t = julian_centuries() if t is None else t
+ d = solar_declination(t)
+ return (d > 0) == (latitude > 0)
+
+
+# TODO document and demo
+def is_winter(latitude, t = None):
+ t = julian_centuries() if t is None else t
+ d = solar_declination(t)
+ return not ((d > 0) == (latitude > 0))
+
+
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