summaryrefslogtreecommitdiffstats
path: root/src/solar.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/solar.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/solar.py b/src/solar.py
index 47fd5be..03cb7ce 100644
--- a/src/solar.py
+++ b/src/solar.py
@@ -437,12 +437,15 @@ def solar_elevation(latitude, longitude, t = None):
return degrees(rc)
-# TODO test, document and demo
+# TODO document and demo
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)
- return (-90 + d < latitude < 90 - d) or (-90 - d < latitude < 90 + d)
+ latitude = abs(latitude) ## Covert everything to the Northern hemisphere
+ if d >= 0:
+ return -90 + d < latitude < 90 - d ## Northern summer
+ else:
+ return -90 - d < latitude < 90 + d ## Northern winter
def future_past_elevation(delta, latitude, longitude, elevation, t = None):