atlanta = ephem.Observer()
atlanta.pressure = 0
atlanta.horizon = '-0:34'
atlanta.lat, atlanta.lon = '89:30', '0'
atlanta.date = '2013/11/26 18:37'
The code above yields the "ephem.AlwaysUpError: 'Moon' is still above the horizon at 2013/11/26 18:37:06" error.
However, if change the date to "2013/11/26 18:38", you get:
which is the correct answer.
Shouldn't next_setting() catch settings that occur within 24 hours?
For reference, libnova does the same thing, see http://stackoverflow.com/questions/19862226/libnova-odd-behavior-for-89-5-degrees-north-latitude for details.
I just realized I have the atlanta.horizon value wrong for the moon. However, changing the date by one minute still shouldn't change the answer so completely?
(the fact that the date in question is today is totally coincidental, BTW)
An IPython Notebook for GitHub issue #32
I have finally had some time to look at your issue, and in the process remind myself how the whole rising-and-setting engine works. Here is an IPython Notebook where I did some graphing and tracing until I figured out what was going on:
The answer to your question is that, no, next_setting() is not designed to find the next setting within 24 hours. Instead, it is designed to find whether the Moon sets on the particular circuit of the sky that it is engaged in. And the two times that you ask about, as you can see from the notebook, fall in different sky-circlings of the Moon.
I will update the Quick Reference and the docstrings for those functions to try to make this distinction clear — I'm sorry that they confused you and wasted some of your time wondering why!
Expand rise/set documentation to fix #32
There! Hopefully that will help things. I am planning for a release on Friday, which will make these changes available if you upgrade. Thanks for letting me know that this was frustrating, and feel free to re-open this issue if you have a further suggestion that could make this PyEphem feature even less confusing.