Skip to content

Update ERFA leap seconds using new IERS LeapSecond class.#9365

Merged
eteq merged 21 commits intoastropy:masterfrom
mhvk:iers-leap-second-list
Oct 27, 2019
Merged

Update ERFA leap seconds using new IERS LeapSecond class.#9365
eteq merged 21 commits intoastropy:masterfrom
mhvk:iers-leap-second-list

Conversation

@mhvk
Copy link
Contributor

@mhvk mhvk commented Oct 14, 2019

A separate follow-up on #9329, which uses a new astropy.utils.iers.LeapSecond class to update the ERFA leap seconds. Here, updates are either gotten from IERS or from IETF.

cc also @aarchiba, whose comments made clear that my previous attempt, which used the IERS tables, was just not going to work (see #9334).

@mhvk
Copy link
Contributor Author

mhvk commented Oct 14, 2019

Hmm, clearly cannot assume that CI machines have up-to-date leap-second files in their virtual machines...

@mhvk mhvk force-pushed the iers-leap-second-list branch 5 times, most recently from f69eaeb to 7dce483 Compare October 15, 2019 01:45
@mhvk
Copy link
Contributor Author

mhvk commented Oct 15, 2019

@bsipocz - is there any way to restart circle-ci jobs? (They failed due to connectivity problems.) Or should I just close/reopen?

@bsipocz
Copy link
Member

bsipocz commented Oct 15, 2019

  • is there any way to restart circle-ci jobs?

yes, log into circleCI and there should be a dropdown somewhere top right with a "Rerun job with SSH" option.

@bsipocz
Copy link
Member

bsipocz commented Oct 15, 2019

or in the workflows menu, there is a "rerun from failed" one.

@bsipocz
Copy link
Member

bsipocz commented Oct 15, 2019

(but then these connection related failures seem to be around all morning, seen the same on numpy an hour or so ago).

@mhvk
Copy link
Contributor Author

mhvk commented Oct 15, 2019

Ah, logging in and out of circle-ci made that option possible (previously it said I had no write access). THanks!

@mhvk
Copy link
Contributor Author

mhvk commented Oct 15, 2019

Oops, didn't mean to start all circle-ci jobs again...

@bsipocz
Copy link
Member

bsipocz commented Oct 15, 2019

(circleCI failure is due to this: https://status.docker.com/)

Copy link
Member

@eteq eteq left a comment

Choose a reason for hiding this comment

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

A few in-line suggestions and some bigger ones here. I'll aim to do another review later when we have #9329 in after you've rebased.

  1. I'm not convinced this belongs in astropy.utils.iers. I think users may want to do updates of leap seconds using this table even independent of IERS. So perhaps it should instead either go in astropy.utils or even astropy.time?
  2. We should add some narrative docs about this, although that could be a follow-on PR since it isn't feature-freeze critical. (I'm also adding the what's new tag to this because I think it's worth highlighting as long as we have the docs for it).
  3. I know this was discussed in #9334 so maybe I missed something in that thread, but... It looks to me like the reason to use the leap second files is because the historical data are needed. Can't we use the current IERS files plus the builtin file to get the latest leap second? That will be wrong if there's multiple intervening leap seconds, but maybe the user doesn't care that much?

The table should hold columns 'year', 'month', 'tai_utc'.

Methods are provided to initialize the table from IERS ``Leap_Second.dat``,
IETF/ntp ``leap-seconds.list``, or built-in ERFA/SOFA.
Copy link
Member

Choose a reason for hiding this comment

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

The seems like a likely gotcha for potential users...

Suggested change
IETF/ntp ``leap-seconds.list``, or built-in ERFA/SOFA.
IETF/ntp ``leap-seconds.list``, or built-in ERFA/SOFA. Note that to
actually update the leap seconds used by ``astropy``, the
`update_erfa_leap_seconds` method must be explicitly called.

Copy link
Member

Choose a reason for hiding this comment

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

I suppose update_erfa_leap_seconds needs double backticks or full API path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done a bit differently, without an explicit name. Could rewrite this part to enumerate all class methods, but that seemed excessive.

@mhvk
Copy link
Contributor Author

mhvk commented Oct 18, 2019

@eteq - on the larger picture: the leap seconds are for a number of time formats including the bog-standard ISO ones, as well as for the critical UTC<->TAI conversion; in contrast, the full IERS A/B files are only needed for UT1 and some coordinate transforms, i.e., in much general use they will never be loaded. To have them be loaded just for leap seconds thus is a bit of an unnecessary overhead, especially given that most computers (even windows now) do have leap second tables stored locally already.

As for the location: since IERS is the organisation responsible for leap seconds, I think it does belong in an iers module (though it could be outside of iers.py. It does bring up a question brought up by @astrofrog whether that iers module still belongs in utils...

@mhvk mhvk force-pushed the iers-leap-second-list branch from eb43147 to e41c891 Compare October 18, 2019 21:20
@mhvk
Copy link
Contributor Author

mhvk commented Oct 18, 2019

@eteq - about being part of iers.py: I have wondered about now effectively always pulling in all of astropy.table just for loading time - but it did seem a bit silly to write a light-weight table-like class just for this. My sense is to leave this for later...

@mhvk
Copy link
Contributor Author

mhvk commented Oct 24, 2019

@eteq - per your request, I now also allow full override of the built-in erfa table, by another special string for initialize_erfa='empty'. I think this is really not something people should use, so prefer this over adding an extra method.

I think this is done apart from your wish for more documentation. For that, I'm not so sure there is a real need - this is the kind of thing almost nobody will ever need, and, if they need it, they better look at the code anyway.

@bsipocz
Copy link
Member

bsipocz commented Oct 24, 2019

I don't see any logical explanation of the travis test failures. Locally I don't see those test collection errors, so will just restart the travis job for now.

@mhvk mhvk force-pushed the iers-leap-second-list branch from b22eed0 to 93700d5 Compare October 26, 2019 21:57
@mhvk mhvk force-pushed the iers-leap-second-list branch from 93700d5 to 87226dc Compare October 26, 2019 23:07
@mhvk
Copy link
Contributor Author

mhvk commented Oct 26, 2019

@eteq - do you want to have a last look? See #9365 (comment) for an overview of the changes (mostly location, code very similar).

@eteq
Copy link
Member

eteq commented Oct 27, 2019

@mhvk - I have a few remaining quibbles but since it's definitely better to get this in even without my quibbles addressed than not at off (and we're really in the cutoff time...) I think it's better to merge these and I can put my quibbles in a separate PR. So merging now!

@eteq eteq merged commit d853a23 into astropy:master Oct 27, 2019
@taldcroft
Copy link
Member

In a clean build of master right now I'm seeing this:

In [1]: from astropy.io import ascii
WARNING: leap-second auto-update failed due to the following exception: ImportError("cannot import name 'convert_numpy'",) [astropy.time.core]

???

@mhvk
Copy link
Contributor Author

mhvk commented Oct 27, 2019

Darn!! There I thought I had finally solved the import order problems. New issue at #9490 (any suggestions most welcome...

@bsipocz
Copy link
Member

bsipocz commented Dec 7, 2019

Given that we've upgraded the bundled erfa to be a released version, the second changelog entry here is not needed any longer, so I removed in for the release (but kept the first part).

@mhvk
Copy link
Contributor Author

mhvk commented Dec 7, 2019

Sure, thanks!

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.

6 participants