Skip to content

Update ERFA leap seconds using IERS table.#9334

Closed
mhvk wants to merge 10 commits intoastropy:masterfrom
mhvk:iers-update-leap-seconds
Closed

Update ERFA leap seconds using IERS table.#9334
mhvk wants to merge 10 commits intoastropy:masterfrom
mhvk:iers-update-leap-seconds

Conversation

@mhvk
Copy link
Contributor

@mhvk mhvk commented Oct 8, 2019

Step 2, following up on #9329, now letting the IERS table update ERFA's leap seconds whenever they are opened. Not 100% sure about the implementation (or the naming), but certainly something to look at.

@mhvk mhvk added this to the v4.0 milestone Oct 8, 2019
@mhvk mhvk force-pushed the iers-update-leap-seconds branch from bcdd5de to 2c8e358 Compare October 9, 2019 01:21
if no matching leap seconds were found, or if the matches are
inconsistent. This would normally suggested a currupted
ERFA or IERS table. The ERFA table can be reset using
`~astropy._erfa.set_leap_seconds()`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`~astropy._erfa.set_leap_seconds()`.
``astropy._erfa.set_leap_seconds()``.

as _erfa is not part of the public API I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good point. Given that, maybe it is better to include an explicit way to reset the table inside iers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now changed the method so that it takes an argument that allows one to initialize the table (and also so that it returns the final one).

@mhvk mhvk force-pushed the iers-update-leap-seconds branch from 2c8e358 to 7c54a24 Compare October 9, 2019 15:54
^^^^^^^^^^^^^

- Leap seconds are now automatically inferred from IERS tables, ensuring that
in normal usage they will not be out of date even if astropy and erfa are
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When does "normal usage" check for new versions of the leap seconds table? When it's been six months since the last bulletin C? When a time is encountered that is more than six months since the last Bulletin C? When someone needs IERS A data for some other non-leap-second purpose?

auto_max_age = _config.ConfigItem(
30.0,
'Maximum age (days) of predictive data before auto-downloading. Default is 30.')
'Maximum age (days) of predictive data before auto-downloading. Dfault is 30.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo introduced?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes I wonder about myself... Thanks, will correct.

@mhvk
Copy link
Contributor Author

mhvk commented Oct 10, 2019

@aarchiba - taking this out of the in-line comments, since it is important: indeed, with the current scheme the light seconds get updated only when an IERS table is opened. And, now that you mention it, this is probably not good enough - we need the leap seconds for TAI-UTC, but the IERS tables are opened only for UT1 and coordinate transforms.

I think we probably need instead to check any time the TAI<->UTC transformation is done (if the time requested is more than 6 months beyond the last leap second / the last time it is checked. Arguably, that means we should start down-loading bulletin C and give up on the approach here.

@eteq - what do you think?

p.s. It would be good to at least get the C integration merged.

@aarchiba
Copy link
Contributor

@aarchiba - taking this out of the in-line comments, since it is important: indeed, with the current scheme the light seconds get updated only when an IERS table is opened. And, now that you mention it, this is probably not good enough - we need the leap seconds for TAI-UTC, but the IERS tables are opened only for UT1 and coordinate transforms.

I think we probably need instead to check any time the TAI<->UTC transformation is done (if the time requested is more than 6 months beyond the last leap second / the last time it is checked. Arguably, that means we should start down-loading bulletin C and give up on the approach here.

It doesn't look like Bulletin C contains information about past leap seconds (except in historical bulletins), so one needs an up-to-date data file of some kind. Unfortunately IERS A is kind of big. Does IERS B contain leap second information? It would seem that being aware of the end of validity of the leap second table currently in use is valuable, as well as some way to update it, even if it is not totally clear yet how best to obtain the information needed to update it.

p.s. It would be good to at least get the C integration merged.

Definitely. Is C needed to be able to obtain the last time we know there are no leap seconds?

@mhvk
Copy link
Contributor Author

mhvk commented Oct 14, 2019

@aarchiba - I'm about to push a different version where IERS C is used (more specifically, the whole set, which includes an expiration date).

@mhvk
Copy link
Contributor Author

mhvk commented Oct 14, 2019

closing in favour of #9365

@mhvk mhvk closed this Oct 14, 2019
@mhvk mhvk deleted the iers-update-leap-seconds branch November 19, 2019 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants