From 9f9c6790d1e55303e5a23b47cab279dba3fdf00b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 5 Jun 2014 03:58:24 +0200 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/solar.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/solar.py b/src/solar.py index d3c19f5..a7815de 100644 --- a/src/solar.py +++ b/src/solar.py @@ -441,11 +441,14 @@ def solar_elevation(latitude, longitude, t = None): def have_sunrise_and_sunset(latitude, t = None): t = julian_centuries() if t is None else t d = degrees(solar_declination(t)) - latitude = abs(latitude) ## Covert everything to the Northern hemisphere + ## Covert everything to the Northern hemisphere + latitude = abs(latitude) if d >= 0: - return -90 + d < latitude < 90 - d ## Northern summer + ## Northern summer + return -90 + d < latitude < 90 - d else: - return -90 - d < latitude < 90 + d ## Northern winter + ## Northern winter + return -90 - d < latitude < 90 + d # TODO document @@ -570,16 +573,19 @@ def past_elevation(latitude, longitude, elevation, t = None): return future_past_elevation(0.01 / -2000, latitude, longitude, elevation, t) +# TODO document def future_past_elevation_derivative(delta, latitude, longitude, elevation_derivative, t = None): fun = lambda t : solar_elevation(latitude, longitude, t) dfun = lambda t : (fun(t + e) - fun(t - e)) / 2 return solar_prediction(delta, elevation_derivative, dfun, t = t) +# TODO document def future_elevation_derivative(latitude, longitude, elevation_derivative, t = None): return future_past_elevation_derivative(0.01 / 2000, latitude, longitude, elevation_derivative, t) +# TODO document def past_elevation_derivative(latitude, longitude, elevation_derivative, t = None): return future_past_elevation_derivative(0.01 / -2000, latitude, longitude, elevation_derivative, t) @@ -606,6 +612,7 @@ def sunrise_equation(latitude, longitude, t = None): return (julian_day_to_julian_centuries(sunset), julian_day_to_julian_centuries(sunrise)) +# TODO document def ptime(t): import datetime print(str(datetime.datetime.fromtimestamp(int(julian_centuries_to_epoch(t))))) -- cgit v1.2.3-70-g09d2