summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-05 03:58:24 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-05 03:58:24 +0200
commit9f9c6790d1e55303e5a23b47cab279dba3fdf00b (patch)
tree997b68f2e62f7b49ad82e451afb56e3ec577fbe1
parentadd solar elevation derivative prediction (diff)
downloadblueshift-9f9c6790d1e55303e5a23b47cab279dba3fdf00b.tar.gz
blueshift-9f9c6790d1e55303e5a23b47cab279dba3fdf00b.tar.bz2
blueshift-9f9c6790d1e55303e5a23b47cab279dba3fdf00b.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/solar.py13
1 files 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)))))