Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Apply iers_degraded_accuracy to stale IERS_Auto predictive values - #20256

Merged
mhvk merged 3 commits into
astropy:mainfrom
CAOShurong:codex/fix-iers-degraded-accuracy
Aug 23, 2026
Merged

Apply iers_degraded_accuracy to stale IERS_Auto predictive values#20256
mhvk merged 3 commits into
astropy:mainfrom
CAOShurong:codex/fix-iers-degraded-accuracy

Conversation

@CAOShurong

Copy link
Copy Markdown
Contributor

Fixes #19823

Problem

When IERS-A data is co-installed via astropy-iers-data (default in current versions), the IERS_Auto class always raised a ValueError when a conversion needed predictive values that were more than auto_max_age days old, even when the user set iers.conf.iers_degraded_accuracy = "warn". With IERS-B only, the same setting yields an IERSDegradedAccuracyWarning.

From the issue, this is a regression from astropy 5.3.3 behavior and was confirmed as a bug by maintainer @mhvk, who invited a PR to apply iers_degraded_accuracy to co-installed data.

Change

IERS_Auto._check_interpolate_indices now honors iers_degraded_accuracy for stale predictive values, matching how IERS treats out-of-range times:

  • "error" (default): raises ValueError (INTERPOLATE_ERROR) as before
  • "warn": emits IERSDegradedAccuracyWarning
  • "ignore": silent

The config item and docs no longer say the setting applies only to IERS-B.

Tests

  • test_iers_degraded_accuracy_warn: warns instead of raising
  • test_iers_degraded_accuracy_ignore: runs silently
  • All 29 test_iers.py tests and 5 time/tests/test_ut1.py tests pass.

IERS_Auto always raised a ValueError when the co-installed IERS-A data
was older than auto_max_age and a conversion needed predictive values,
regardless of iers_degraded_accuracy. This regressed from IERS-B-only
behavior where 'warn'/'ignore' were honored.

Now IERS_Auto._check_interpolate_indices behaves like IERS does for
out-of-range times: the default 'error' still raises ValueError, 'warn'
emits IERSDegradedAccuracyWarning, and 'ignore' is silent. This matches
the maintainer-invited fix requested in issue astropy#19823.

Tests: 2 new TestIERS_Auto cases for 'warn' and 'ignore'; all 29 IERS
suite tests and 5 time/ut1 tests pass.
@github-actions

Copy link
Copy Markdown
Contributor

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.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@pllim pllim added this to the v8.1.0 milestone Aug 20, 2026

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@CAOShurong - Thanks, this looks good! Let me start CI.

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK, tests passed, so let's get this in. Thanks again, @CAOShurong!

@mhvk mhvk added Bug and removed Docs labels Aug 23, 2026
@mhvk

mhvk commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

p.s. Am keeping milestone as is, since while I consider it a bug, it is also a kind of API change.

@mhvk

mhvk commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Hmm, somehow the earlier tests passed, but now that I changed the label to bugfix, they do not. Could you move the changelog fragment to have the same number as the PR instead of the issue it fixes? Thanks!

…r 19823

The towncrier check requires the changelog fragment filename to match
the PR number, not the linked issue number.
@CAOShurong

Copy link
Copy Markdown
Contributor Author

Renamed the changelog fragment from \19823.bugfix.rst\ to \20256.bugfix.rst\ to use the PR number as expected by towncrier.

@CAOShurong

Copy link
Copy Markdown
Contributor Author

Small correction to my earlier note: the changelog fragment was renamed from 19823.bugfix.rst to 20256.bugfix.rst to use the PR number as expected by towncrier.

@mhvk
mhvk merged commit 9f4de8d into astropy:main Aug 23, 2026
37 of 38 checks passed
@mhvk

mhvk commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Thanks again, @CAOShurong - I've now merged.

mhvk added a commit to mhvk/astropy that referenced this pull request Aug 23, 2026
@mhvk

mhvk commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

O, shoot, I should have looked better at the devdeps failure, that is actually real, due to this PR! I've made a quick fix myself at #20262.

CAOShurong pushed a commit to CAOShurong/CAOShurong that referenced this pull request Aug 23, 2026
- manifest: add astropy/astropy#20256 (scientific track), now 20 entries
- README: merged-entry + updated totals paragraph
- tests: snapshot shape 19/10/9 -> 20/11/10
- svg regenerated deterministically
pllim added a commit that referenced this pull request Aug 24, 2026
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.

IERS-A data emitted IERSDegradedAccuracyWarning in astropy 5.3.3 but throws ValueError in astropy 7 or later

3 participants