PyEphem: How to calculate the minimum height of the sun (greatest angle the sun will reach below the horizon)?
1 answer
Use transit_time, next_antitransit, to get the range of angles that the sun will reach. The transit time is when the sun reaches the meridian through your observer location, and this of course corresponds to when the sun reaches its maximum height. The same goes for anti-transport (when the sun reaches the back of the meridian)
For example:
... #create observer
sun = ephem.Sun(obs)
obs.date = sun.transit_time
maximum_altitude = sun.alt
And to get the lowest height you can do:
obs.date = obs.next_antitransit(sun) sun.compute(obs) minimum_altitude = sun.alt
+2
source to share