Fix IERS_Auto logic now that IERS-A is bundled - #16187
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
👋 Thank you for your draft pull request! Do you know that you can use |
7c17771 to
7ea06a4
Compare
|
Just a heads-up that this patch seems to touch some of the same lines than #16070, so merge conflicts might ensue. That said, my own PR is currently stuck so I don't have a problem with this one going in first, mind you. I'm also happy to serve as a reviewer if needed ! |
|
I think #16070 will be sufficiently orthogonal – improving how IERS-A and IERS-B are combined versus merely ensuring that the combination even happens – that any merge conflicts should be trivial to resolve. |
pllim
left a comment
There was a problem hiding this comment.
Thanks! Does the content of https://docs.astropy.org/en/stable/utils/data.html also need updating?
|
Ah, indeed, that page should be edited too |
mhvk
left a comment
There was a problem hiding this comment.
Thanks so much! I have one question on the implementation, whether it might not be even simpler to just preserve whatever has been downloaded (which in itself would seem more logical). What do you think? I am happy to go with what you have as well, as it resolves the biggest issues.
Beyond that, only a nitpick on the changelog entry...
| @@ -0,0 +1 @@ | |||
| The return type of ``IERS_Auto.open()`` is no longer ``IERS_B`` when automatic updating of the IERS-A file is disabled or the downloading of the new file fails. | |||
There was a problem hiding this comment.
I think we should add what it is now! Maybe
IERS_Auto.open() now defaults to the combination of IERS_A and B data bundled
in the astropy-iers-data dependency rather than to IERS_B only when automatic ...
| @@ -786,7 +790,7 @@ def open(cls): | |||
|
|
|||
| """ | |||
| if not conf.auto_download: | |||
There was a problem hiding this comment.
I guess the alternative path, which would preserve anything downloaded, would simply be to remove this stanza and in the else clause of the for loop warn only if conf.auto_download is set.
Am I missing something?
There was a problem hiding this comment.
Discussion concluded we should leave this for follow-up
Yes, that could be done, but the edge case that worries me is a user who does not want automatic downloading but at some point in the past happened to download IERS-A. Once that file is in the cache, that stale IERS-A file would continue to be used (by default) despite any subsequent updates of Of course, the natural solution would be to inspect both the IERS-A file from |
|
@ayshih - yes, good point. So, I guess to get this to work one would have to also change p.s. We can obviously move this to a new issue/PR! |
|
Let's get this PR in to solve the easy-to-encounter bug, and defer the improved handling of two IERS-A files to a future PR. I've updated the documentation more, including https://docs.astropy.org/en/stable/utils/data.html |
mhvk
left a comment
There was a problem hiding this comment.
Looks good! (modulo the failure of course!)
| therefore recommend the following guidelines: | ||
|
|
||
| * Do one of the following: | ||
| * Set ``astropy.utils.iers.conf.auto_download = False`` in your Astropy config |
There was a problem hiding this comment.
I like this change to have just one recommended way!
mhvk
left a comment
There was a problem hiding this comment.
@ayshih - I have a few more nitpicky comments on docstrings, to join those of @eerovaher. Will merge once those are done.
Thanks!
| @@ -786,7 +790,7 @@ def open(cls): | |||
|
|
|||
| """ | |||
| if not conf.auto_download: | |||
There was a problem hiding this comment.
Discussion concluded we should leave this for follow-up
neutrinoceros
left a comment
There was a problem hiding this comment.
Thank you so much for doing this. Not only is it fixing a subtle bug that has already confused several users, it's also making the underlying logic easier to reason about ! I only have a couple small suggestions and questions, but overall LGTM
|
I totally forgot about this PR. I've addressed the comments from @neutrinoceros and rebased the PR. |
neutrinoceros
left a comment
There was a problem hiding this comment.
LGTM now, thanks !
Description
#14819 moved the IERS files to a separate package (
astropy-iers-data), and now IERS-A is essentially bundled withastropy. However, there persist some remnants of the old logic, where IERS-A is available only if the download were triggered. This results in the peculiar behavior that if automatic downloading of IERS-A files is disabled (iers.conf.auto_download = False) or fails, the bundled IERS-A file is ignored even though it is present (see #13227 (comment)).This PR fixes the logic so that the bundled IERS-A file is used if
iers.conf.auto_download = False, with corresponding fixes in documentation and tests.This PR does not attempt to fix the logic so that a previously downloaded IERS-A file is used if
iers.conf.auto_downloadis subsequently set toFalse. I didn't want to wrap my head around whether the downloaded file should have priority over the bundled file, given thatastropy-iers-datacould also be upgraded.Fixes #13227: With
astropy6.0, the response to the report would be to upgradeastropy-iers-datato obtain a recent IERS-A table. This PR then fixes the residual bug where settingiers.conf.auto_download = Falsewould ignore that bundled IERS-A table.Fixes #16128: Because the bundled IERS-A is now no longer ignored by the default
IERS_Autowhen downloading is blocked, it's now typically impossible to trigger the "degraded accuracy" error/warning unless the user expressly forces the use of the IERS-B data alone (e.g., through theearth_orientation_tableScienceState).Other related issues: