Open dm-maxar opened 5 months ago
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!
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.
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.