3

Depending on the seasons, it looks like the sun will never go lower than a certain angle with respect to the horizon at some areas.

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

  • 1
    In general, you need to be able to handle AlwaysUpErrors whenever you're dealing with locations above the arctic circle.. – thebjorn Jul 04 '17 at 14:36

1 Answers1

3

To get the range of the angles where the sun will reach, use the transit_time, next_antitransit functions. The transit time is when the sun reaches the meridian through your observer location, and that of course corresponds to when the sun reaches its highest altitude. The same idea goes for the anti-transit (when the sun reaches the back side 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 altitude, you can do:

obs.date = obs.next_antitransit(sun)
sun.compute(obs)
minimum_altitude = sun.alt
JobHunter69
  • 1,706
  • 5
  • 25
  • 49