Skip to content

Add support for reading compressed FITS files with UNCOMPRESSED_DATA#19363

Merged
saimn merged 5 commits intoastropy:mainfrom
astrofrog:support-uncompressed-data
Mar 16, 2026
Merged

Add support for reading compressed FITS files with UNCOMPRESSED_DATA#19363
saimn merged 5 commits intoastropy:mainfrom
astrofrog:support-uncompressed-data

Conversation

@astrofrog
Copy link
Copy Markdown
Member

@astrofrog astrofrog commented Mar 6, 2026

Description

This PR adds support for reading in FITS files that use the legacy UNCOMPRESSED_DATA fallback mechanism (rather than GZIP_COMPRESSED_DATA).

The fact this didn't work let two two issues which shows these files do exist in the wild:

Just to confirm, this seems to work with the file linked in #17821

Not sure if this is an enhancement or a bug fix though - what do you think @saimn?

The diff for _tiled_compression.py makes more sense if you ignore whitespace diffs

Fixes #15477
Fixes #17821

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

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.

@saimn saimn added this to the v7.2.1 milestone Mar 6, 2026
@saimn saimn added the backport-v7.2.x on-merge: backport to v7.2.x label Mar 6, 2026
@saimn
Copy link
Copy Markdown
Contributor

saimn commented Mar 6, 2026

Thanks, LGTM.
Probably bugfix since astropy used to read those files (and maybe even write them as suggested in a comment in one the issues?). Let's see if backport is easy, otherwise we can keep this for 8.0.

@astrofrog astrofrog added Bug and removed Bug labels Mar 6, 2026
@astrofrog
Copy link
Copy Markdown
Member Author

I'm tempted to call it a bug fix since it is stopping people opening real FITS files. Do you agree @saimn?

@astrofrog astrofrog marked this pull request as ready for review March 6, 2026 13:36
@astrofrog astrofrog requested a review from saimn as a code owner March 6, 2026 13:36
@astrofrog
Copy link
Copy Markdown
Member Author

@saimn - ok I've now added a bugfix changelog entry so this is ready for review. I'll try and check whether we ever supported writing but tbh I'm not sure we should since it's no longer recommended?

Comment thread docs/changes/io.fits/19363.bugfix.rst Outdated
@pllim
Copy link
Copy Markdown
Member

pllim commented Mar 6, 2026

@saimn do you want to officially approve?

Thanks, all!

@pllim
Copy link
Copy Markdown
Member

pllim commented Mar 6, 2026

Also, precommit got stuck, so please rebase?

@astrofrog astrofrog force-pushed the support-uncompressed-data branch from 162d385 to e5a3571 Compare March 6, 2026 22:16
@astrofrog
Copy link
Copy Markdown
Member Author

@saimn should definitely review this before it is merged

@astrofrog
Copy link
Copy Markdown
Member Author

@saimn - just to check, as you said LGTM higher up, can you approve this if you are happy with it?

Copy link
Copy Markdown
Contributor

@saimn saimn left a comment

Choose a reason for hiding this comment

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

Thanks @astrofrog !

@saimn saimn merged commit ab1ba09 into astropy:main Mar 16, 2026
40 of 42 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/astropy that referenced this pull request Mar 16, 2026
pllim added a commit that referenced this pull request Mar 16, 2026
…363-on-v7.2.x

Backport PR #19363 on branch v7.2.x (Add support for reading compressed FITS files with UNCOMPRESSED_DATA)
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.

FITS Compressed File Opening Issue Version 5.3 fails to correctly read (some) rice-compressed files.

3 participants