From 4d0be4101a020ed659ba1fd233b0ea0c89546f00 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 5 Jun 2014 02:28:59 +0200 Subject: add is_summer and is_winter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/solar.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') 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 -- cgit v1.2.3-70-g09d2