This script is supposed to get the transit time, get the angle of the transit time, and then get the time when the angle is reached. The two print statements I gave should give equivalent outputs.
import ephem
obs = ephem.Observer()
obs.lat = '30'
obs.long = '30'
sun = ephem.Sun(obs)
obs.date = sun.transit_time
sun.compute(obs)
altitude = sun.alt
obs.horizon = altitude
print(obs.next_setting(ephem.Sun(), use_center = True))
Instead, this is giving me a NeverUpError. That doesn't make any sense. I tried with coordinates of 20,20. It didn't give an error but the times were mismatched.
Traceback (most recent call last): File "test.py", line 11, in print(obs.next_setting(ephem.Sun(), use_center = True)) 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 466, in _riset_helper d0 = visit_transit() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ephem/init.py", line 410, in visit_transit % (body.name, d)) ephem.NeverUpError: 'Sun' transits below the horizon at 2017/7/12 10:05:39