PyEphem: How to calculate the minimum height of the sun (greatest angle the sun will reach below the horizon)?

Depending on the season, it looks like the sun will never go below a certain angle relative to the horizon in some areas.

Is there a way in PyEphem to calculate the smallest possible angle at specific times and locations so I can avoid AlwaysUpError?

+3


source to share


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







All Articles