-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
Defining an equally spaced range of times using only years argument gives a sawtooth #436
Comments
I will have to think about this one. The sensible move would be to outlaw non-integral UTC years, as UTC does not define any notion (so far as I'm aware) of what a fractional UTC year would mean. The exception could point users to a new method that could be added, python-skyfield/skyfield/timelib.py Line 673 in f2fe099
But that could cause existing Skyfield programs to die with an error. It might be worth the cost but I'll have to think about it. The only other reasonable alternative I can think of would be to interpret the fraction as fractions of whatever length that particular year is — so 2011.5 would mean "2011 plus half of 365 days" while 2012.5 would mean "2012 plus half of 366 days". All programs that currently work would hopefully continue to work (but would give somewhat different answers than today, as the stair-stepping you see would disappear), but the computation would be a bit more costly — and would introduce a new Skyfield-specific non-uniform time scale "UTC years" that might generate confusion since the fraction would mean different amounts in different years. Hmm. |
What where the uses you did expect and plan for? For example:
What did you envision exactly for each field? I ask because you have excellent intuition, so it's likely you had a plan for this but since you've been working on so many aspects in parallel you might need to re-remember it. |
My basic vision was:
I'm not sure fractions make sense in any of the other fields — or at least they definitely won't create motion whose derivative is stable, because (a) the length of the minute, and thus of the hour and day, jumps upward temporarily whenever there is a leap second, and (b) the lengths of months and years are of course not equal. |
@davidmikolas For your question 2
You could break the time generation into subparts, something along the lines of for i in range(1, 365*20): # 20 year sample daily
times = ts.utc(2020, 1, i, 0, 0, range(0, 60*60*24, 300)) # single day sample, every 5 minutes
... and append the computations inside the loop as appropriate (note the index times._nutation_angles = iau2000b_radians(times) will be quicker. ps. this looks a bit odd but I think it will work because days can count beyond a month, eg. >>> times = ts.utc(2020, 1, 954, 0, 0, range(1, 100)) # 954 is random
>>> times
<Time tt=[2459802.500812315 ... 2459802.501946574] len=99>
>>> times[0].utc_iso()
'2022-08-11T00:00:01Z' |
@glangford Thank you for the suggestions. My understanding of time (in Skyfield, in Astronomy, and even in the real world) is limited! My goal here was to get a time array that spanned 20 years, spaced at roughly 1 hour intervals. Moving the fractions from
@brandon-rhodes But it would be great to have a time generator in Skyfield that simply accepts a start time object and an end time object and either a number of points or a spacing that worked just like I suppose they would need one more argument that specified in which time scale they should be equally spaced or perhaps there is one obvious choice (perhaps TDB) and it would simply use that. |
Having thought about it for a few days, I am not quite ready yet to duplicate or wrap |
Thank you very much for the speedy disposition, conclusion, and solution! |
The following script causes the Moon to jump, likely because the the years argument doesn't like tiny spaces.
The text was updated successfully, but these errors were encountered: