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

Allow building timescale from custom url for finals2000A.all #938

Open
dm-maxar opened this issue Feb 2, 2024 · 2 comments
Open

Allow building timescale from custom url for finals2000A.all #938

dm-maxar opened this issue Feb 2, 2024 · 2 comments

Comments

@dm-maxar
Copy link

dm-maxar commented Feb 2, 2024

At the moment, the hard-coded URL for directly loading finals2000A.all appears to be on an ftp server that is down for me.

If there was a way for me to specify the URL or a file object that has the contents of finals2000A.all in the constructor for TimeScale, that would allow me to create a TimeScale from a working URL that has the most current estimates.

It would also allow easy creation of TimeScale objects have different assumptions about delta T predictions in the future. For instance, if a user needed to assess the sensitivity of a calculation to future estimates of delta T, they could create TimeScales from different finals2000A.all files containing different assumptions and assess the variability of calculations based on different delta T.

@brandon-rhodes
Copy link
Member

Yes, you can build the Timescale yourself from any data you would like. I should add a section to the documentation showing how. Try this out and see if it works for you:

from skyfield.api import Timescale
from skyfield.data import iers

with open('finals2000A.all', 'rb') as f:
    utc_mjd, dut1 = iers.parse_dut1_from_finals_all(f)

arrays = iers.build_timescale_arrays(utc_mjd, dut1)
daily_tt, daily_delta_t, leap_dates, leap_offsets = arrays
ts = Timescale((daily_tt, daily_delta_t), leap_dates, leap_offsets)

The interface is a bit unfortunate, but that's because it evolved piecemeal, and has always been purely internal. Hmm. I wonder, in retrospect, if I should really have shoehorned all those arrays into the constructor, or if I should have had a simple constructor like Timescale() and then had the user call follow-up methods to install the arrays.

Anyway, if this works for you, I can cut and paste it into the docs for future users!

@dm-maxar
Copy link
Author

dm-maxar commented Feb 2, 2024

Oh hey, that works. I was working with iers.parse_dut1_from_finals_all() but I hadn't seen build_timescale_arrays and made the connection.

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

No branches or pull requests

2 participants