summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--info/blueshift.texinfo37
-rw-r--r--src/solar.py43
2 files changed, 80 insertions, 0 deletions
diff --git a/info/blueshift.texinfo b/info/blueshift.texinfo
index 1b9a344..b61d28e 100644
--- a/info/blueshift.texinfo
+++ b/info/blueshift.texinfo
@@ -900,6 +900,43 @@ time in Julian Centuries. All parameters are floating point
and may not be @code{None}, except for in @code{solar_elevation},
as specified.
+Blueshift provides constants with important elevations of
+the Sun during twilight.
+
+@table @code
+@item SOLAR_ELEVATION_SUNSET_SUNRISE
+The Sun's elevation at sunset and sunrise,
+measured in degrees.
+
+@item SOLAR_ELEVATION_CIVIL_DUSK_DAWN
+The Sun's elevation at civil dusk and civil dawn,
+measured in degrees.
+
+@item SOLAR_ELEVATION_NAUTICAL_DUSK_DAWN
+The Sun's elevation at nautical dusk and nautical
+dawn, measured in degrees.
+
+@item SOLAR_ELEVATION_ASTRONOMICAL_DUSK_DAWN
+The Sun's elevation at astronomical dusk and
+astronomical dawn, measured in degrees.
+
+@item SOLAR_ELEVATION_RANGE_TWILIGHT
+The Sun's lowest and highest elevation during all
+periods of twilight, measured in degrees.
+
+@item SOLAR_ELEVATION_RANGE_CIVIL_TWILIGHT
+The Sun's lowest and highest elevation during
+civil twilight, measured in degrees.
+
+@item SOLAR_ELEVATION_RANGE_NAUTICAL_TWILIGHT
+The Sun's lowest and highest elevation during
+nautical twilight, measured in degrees.
+
+@item SOLAR_ELEVATION_RANGE_ASTRONOMICAL_TWILIGHT
+The Sun's lowest and highest elevation during
+astronomical twilight, measured in degrees.
+@end table
+
@node Terminology
diff --git a/src/solar.py b/src/solar.py
index 6790c3e..8c79d79 100644
--- a/src/solar.py
+++ b/src/solar.py
@@ -18,6 +18,49 @@ import math
import time
+
+SOLAR_ELEVATION_SUNSET_SUNRISE = 0.0
+'''
+:float The Sun's elevation at sunset and sunrise, measured in degrees
+'''
+
+SOLAR_ELEVATION_CIVIL_DUSK_DAWN = -6.0
+'''
+:float The Sun's elevation at civil dusk and civil dawn, measured in degrees
+'''
+
+SOLAR_ELEVATION_NAUTICAL_DUSK_DAWN = -12.0
+'''
+:float The Sun's elevation at nautical dusk and nautical dawn, measured in degrees
+'''
+
+SOLAR_ELEVATION_ASTRONOMICAL_DUSK_DAWN = -18.0
+'''
+:float The Sun's elevation at astronomical dusk and astronomical dawn, measured in degrees
+'''
+
+SOLAR_ELEVATION_RANGE_TWILIGHT = (-18.0, 0.0)
+'''
+:(float, float) The Sun's lowest and highest elevation during all periods of twilight, measured in degrees
+'''
+
+SOLAR_ELEVATION_RANGE_CIVIL_TWILIGHT = (-6.0, 0.0)
+'''
+:(float, float) The Sun's lowest and highest elevation during civil twilight, measured in degrees
+'''
+
+SOLAR_ELEVATION_RANGE_NAUTICAL_TWILIGHT = (-12.0, -6.0)
+'''
+:(float, float) The Sun's lowest and highest elevation during nautical twilight, measured in degrees
+'''
+
+SOLAR_ELEVATION_RANGE_ASTRONOMICAL_TWILIGHT = (-18.0, -12.0)
+'''
+:(float, float) The Sun's lowest and highest elevation during astronomical twilight, measured in degrees
+'''
+
+
+
def sun(latitude, longitude, t = None, low = -6.0, high = 3.0):
'''
Get the visibility of the Sun