diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-06-05 02:28:59 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-06-05 02:28:59 +0200 |
commit | 4d0be4101a020ed659ba1fd233b0ea0c89546f00 (patch) | |
tree | 26b001e50174398997ac255c76ad74e0c820bc40 /src/solar.py | |
parent | fix have_sunrise_and_sunset (diff) | |
download | blueshift-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 '')
-rw-r--r-- | src/solar.py | 14 |
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 |