Pyephem doesn't catch moonset in next 13+ hours at 89.5 latitude #32

Closed
barrycarter opened this Issue Nov 26, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@barrycarter

import ephem
atlanta = ephem.Observer()
atlanta.pressure = 0
atlanta.horizon = '-0:34'
atlanta.lat, atlanta.lon = '89:30', '0'
atlanta.date = '2013/11/26 18:37'
print atlanta.next_setting(ephem.Moon())

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:

2013/11/27 07:37:20

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.

@barrycarter

This comment has been minimized.

Show comment
Hide comment
@barrycarter

barrycarter Nov 26, 2013

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)

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)

@brandon-rhodes

This comment has been minimized.

Show comment
Hide comment
@brandon-rhodes

brandon-rhodes May 21, 2014

Owner

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:

http://nbviewer.ipython.org/github/brandon-rhodes/pyephem/blob/master/issues/github-issue-32.ipynb

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!

Owner

brandon-rhodes commented May 21, 2014

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:

http://nbviewer.ipython.org/github/brandon-rhodes/pyephem/blob/master/issues/github-issue-32.ipynb

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!

@brandon-rhodes

This comment has been minimized.

Show comment
Hide comment
@brandon-rhodes

brandon-rhodes May 21, 2014

Owner

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.

Owner

brandon-rhodes commented May 21, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment