summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-05 03:56:54 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-05 03:56:54 +0200
commit8e7c27bb6e62339d59b346eeb6c89d78660eed22 (patch)
tree0daff80e99d0cd66e2634ba628576b48c7543555
parentm (diff)
downloadblueshift-8e7c27bb6e62339d59b346eeb6c89d78660eed22.tar.gz
blueshift-8e7c27bb6e62339d59b346eeb6c89d78660eed22.tar.bz2
blueshift-8e7c27bb6e62339d59b346eeb6c89d78660eed22.tar.xz
add solar elevation derivative prediction
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/solar.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/solar.py b/src/solar.py
index ef74c08..d3c19f5 100644
--- a/src/solar.py
+++ b/src/solar.py
@@ -516,7 +516,7 @@ def past_equinox(t = None):
# TODO document
def future_past_solstice(delta, t = None):
e = 0.00001
- fun = lambda t : (solar_declination(t - e) - solar_declination(t + e)) / 2
+ fun = lambda t : (solar_declination(t + e) - solar_declination(t - e)) / 2
return solar_prediction(delta, 0, fun, t = t)
@@ -570,6 +570,20 @@ def past_elevation(latitude, longitude, elevation, t = None):
return future_past_elevation(0.01 / -2000, latitude, longitude, elevation, t)
+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)
+
+
+def future_elevation_derivative(latitude, longitude, elevation_derivative, t = None):
+ return future_past_elevation_derivative(0.01 / 2000, latitude, longitude, elevation_derivative, t)
+
+
+def past_elevation_derivative(latitude, longitude, elevation_derivative, t = None):
+ return future_past_elevation_derivative(0.01 / -2000, latitude, longitude, elevation_derivative, t)
+
+
# TODO: This algorithm is imprecise, gives an incorrent sunrise and I do not fully know its behaviour
def sunrise_equation(latitude, longitude, t = None):
j_cent = julian_centuries() if t is None else t