Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time scale repeats with a period of 13 months! #461

Closed
bassemsabra opened this issue Oct 11, 2020 · 8 comments
Closed

Time scale repeats with a period of 13 months! #461

bassemsabra opened this issue Oct 11, 2020 · 8 comments

Comments

@bassemsabra
Copy link

The time scale generated by "range" repeats with a period of 13 months. For example, if you start with 2002 1 1, the time will go to 2002 12 1, 2003 1 1, 2003 2 1, and instead of 2003 3 1 you will get 2002 1 1 and it repeats all the months 2002. The loop continues till you reach the total number of indicated months. I tried downloading the NASA stuff (builtin='False'), forced it to download delta's every time I run, experimented with various start dates and number of months, etc. Nothing worked. Here is the relevant code.

import scipy.optimize
from skyfield.api import load, pi, tau
import numpy as np
from skyfield import api
from skyfield import almanac
from datetime import timedelta

ts = api.load.timescale(builtin='True')
t = ts.utc(2002, range(1, 43))
print(t[26]-t[14])
print(t[14]-t[2])

output:
0
0
Please help. Thanks.

@davidmikolas
Copy link

davidmikolas commented Oct 11, 2020

Strange, I get this, which is I think what you are expecting.

Try starting from a clean script. All the imports suggest that this is from a larger script and there may be something else going on.

The imports don't hurt anything, but maybe you have other bits of script interfering.

A clue might be that your output are integer zeros, whereas my output are floating point numbers.

import scipy.optimize
from skyfield.api import load, pi, tau
import numpy as np
from skyfield import api
from skyfield import almanac
from datetime import timedelta
ts = api.load.timescale(builtin='True')
t = ts.utc(2002, range(1, 43))
print(t[26]-t[14])
367.0
print(t[14]-t[2])
367.0
print(t[14]-t[14])
0.0

@bassemsabra
Copy link
Author

Thnx. In my prev exp, I just isolated everything and just simply ran the timescale script and I still got nowhere. I will see if the floating number might fix it, though I doubt it since when I list all the times - print (t.utc_jpl()) - The dates start to repeat themselves after the 14 entry. That's how I figured zoomed in on the problem. I even exp with another python installation on another machine. Nothing helped.

@brandon-rhodes
Copy link
Member

@bassemsabra — Thank you so much for drawing attention to this regression! My recent efforts to support the old Julian calendar for historians inadvertently broke the ability of Skyfield to interpret out-of-range months as referring to other years.

I have just committed a fix and will go ahead and make a new release. Thanks again for letting me know!

@bassemsabra
Copy link
Author

@brandon-rhodes - Thank YOU for the prompt response! Do you know when the issue will be fixed? Let me say also that Skyfield is FANTASTIC. I am new to it and it has opened a new universe for me, and I am a astrophysicist by profession!

@brandon-rhodes
Copy link
Member

Thank you for the kind words! The issue is now fixed and I have just released Skyfield 1.30 that includes the fix. A pip install -U skyfield should hopefully get you working again!

@bassemsabra
Copy link
Author

ASTRONOMICAL THANKS!

@davidmikolas
Copy link

@brandon-rhodes there's something about this package that just keeps eliciting enthusiasm :-)

Sorry to trouble you, If possible can you just briefly mention why you mention "recursion" and why I can't reproduce the problem?

Thanks!

@brandon-rhodes
Copy link
Member

@davidmikolas — Could you confirm which version of Skyfield you are currently using? And I will be happy to expand further on "recursion" if you will remind me where I used the word. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants