-
Notifications
You must be signed in to change notification settings - Fork 49
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
d2dtf(), dtf2d(), utctai(), dat(): Inexact table and method of detecting jump #92
Comments
@mrhso - thanks for reporting! And even more for suggesting fixes. Since this is a problem in SOFA, I think we will have to give specific examples using the ERFA/SOFA routines (just to show it is not astropy wrapping it incorrectly). It looks like you already have been changing the code, so it may be easy for you to provide such examples to forward to SOFA (if not, I can do it). |
It also shows #91. (SOFA 20210512)
(SOFA 20210512 with
Result:
|
(SOFA 20210512 with modified)
Result:
|
@PTW19 - while you happen to have been looking at our ERFA repository, do you mind if I draw your attention to this one, about leap seconds? Here it looks to me like @mrhso has uncovered a genuine bug; some test code and suggested fixes are provided in the thread. p.s. @mrhso - apologies for not reacting to this earlier; your examples are very useful!! |
This is how they were defined: see Table 3 in the Explanatory Supplement (3rd edition). Consequently things don't quite tie together, up to and including the final transition to the leap second era as 1972 Jan 1 begins. Another factor in the strange-looking results is that 9 digits for ndp in the iauD2dtf call is pushing it. If you drop back to 8 you do get the expected result: 1972 1 1 0 0 0 0 I'm aware the D2DTF comments say 9 should be safe, but evidently rounding errors have started to creep in at that point on the platforms we are both using. As a first step, please see if these comments explain the reported effects. |
TimeSteps.history, the table of the frequency offsets and steps which should be the original definition, is available from the IERS EOC.
Obtaining a complete table is possible.
Let |
Compare the tables of 1e-7 one and exact one. The former will be |
SOFA has tended to rely on the USNO Time Service, especially as the Board included members from that department. Here's the table they publish: []https://web.archive.org/web/20191019051734/http://maia.usno.navy.mil/ser7/tai-utc.dat I wasn't conscious that it is a derived product and includes redundancy, but it doesn't surprise me. It's probably too late for SOFA to go back to the "urtext" of the WWV time and frequency steps, but there's no reason for ERFA not to do so. Indeed, the special licensing conditions for the SOFA DAT routines mean you could even leave it with the "iau" prefix if you wanted to. |
BTW thanks for pointing out that using 9 as the D2DTF ndp argument wasn't the cause of the stray 2. Reassuring. |
@mrhso - thanks for that investigation! I think we should make the adjustments you suggested. Would you be able to open a PR? @PTW19 - are you sure SOFA should not follow? It feels to me @mrhso essentially uncovered a transcription bug in SOFA (even if the bug is due to the supplement, not SOFA). From the ERFA side, I really prefer there to be no differences between SOFA and ERFA (the |
I take it by "transcription error" you mean that the USNO Time Service description of UTC versus TAI is not a rigorous equivalent to the IERS description. Although I'm sure the SOFA Board will be uncomfortable with changing the behavior of the DAT routine, it is worth taking it as far as producing a definitive revised algorithm. So if mrhso can supply actual C code for a rigorous iauDat I'll be happy to take it from there. |
That's not the case. IERS EOP also provides UTC-TAI.history, which has no difference with USNO's table except for format. |
Good. So SOFA has the choice of improving on what the BIH published in 1972 or taking it as canonical. I vote for the latter. |
The pre-1972$10^{-7}\kern{3 mu}\text{s}$ , leading to strange results.
_changes
are approximated toExample (After #91 fixed)
In theory, it should be earlier than 1972-01-01 00:00:10, for 1972-01-01 00:00:00 UTC = 1972-01-01 00:00:10 TAI and the step was -0.1077580 s.
And the method of detecting jump is also inexact.
The end of a day may not be 24:00:00 but 24:00:00+dleap.
So$\text{dleap}=\text{dat24}-\left(\text{dat0}+\dfrac{24\kern{3 mu}\text{h}+\text{dleap}}{24\kern{3 mu}\text{h}}\text{dlod}\right)$ , that is, $\text{dleap}=\dfrac{\text{ERFA\_DAYSEC}}{\text{ERFA\_DAYSEC}+\text{dlod}}(\text{dat24}-(\text{dat0}+\text{dlod}))$ .
Interestingly, this inexact method just matches$10^{-7}\kern{3 mu}\text{s}$ precision,
dleap
is calculated correctly (just a coincidence).So the table
_changes
and the method of detecting jump may need to be modified at the same time.The text was updated successfully, but these errors were encountered: