not_this_website
not_this_website

Reputation: 69

PyEphem: AlwaysUpError for the Sun occurs in a location where this shouldn't happen

import ephem
rwth = ephem.Observer()
rwth.lat = '50.8'
rwth.long = '6.1'
rwth.horizon = '-18'
rwth.next_setting(ephem.Sun())

This will result in an error

Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ephem/init.py", line 498, in next_setting return self._riset_helper(body, start, use_center, False, False) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ephem/init.py", line 470, in _riset_helper d1 = visit_antitransit() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ephem/init.py", line 418, in visit_antitransit % (body.name, d)) ephem.AlwaysUpError: 'Sun' is still above the horizon at 2017/7/3 23:39:58

However, at this location, the sun should definitely reach astronomical twilight (which -18 degrees corresponds to). Do you know what the problem is?

Upvotes: 0

Views: 615

Answers (1)

Brandon Rhodes
Brandon Rhodes

Reputation: 89462

At that latitude at this date (very early July), the Sun never does, in fact, reach –18° altitude, because 50.8° north is too close to the Arctic Circle. On the solstice itself — around June 21 each year — the Sun is at 23.5° north, which, if we think through the consequences, means:

  • An observer at the North Pole would see the Sun circle the sky at 23.5° above the horizon all day.
  • An observer at 90° – 23.5° = 66.5° would see the Sun spend the whole day on the horizon, making a circle along its circumference.
  • An observer would have to be at 90° – 23.5° – 18° = 48.5° latitude or even further south in order for the Sun to dip low enough for them to observe the level of darkness defined as astronomical twilight.

Even though the current date is a few days after the equinox, the Sun has not yet retreated far enough from its farthest-north latitude to begin to bring astronomical twilights to the location you are asking about. PyEphem’s answer looks correct here.

Upvotes: 1

Related Questions