Skip to content

Gzipped FITS BinTableHDU readonly now #6862

@nabobalis

Description

@nabobalis

Recently, we noticed a test failure within SunPy against astropy master.

We have a test that opens a gzipped fits file and makes some adjusts to the data to remove potential bad values. We get that

ValueError: assignment destination is read-only

This seems to only occur for any FITS data that is returned with a astropy.io.fits.hdu.table.BinTableHDU, astropy.io.fits.hdu.image.PrimaryHDU are unaffected by this.

Example would be:

from astropy.io import fits
afile = fits.open('go1520120601.fits.gz') #from https://github.com/sunpy/sunpy/blob/master/sunpy/data/test/go1520120601.fits.gz
print(afile)
#[<astropy.io.fits.hdu.image.PrimaryHDU object at 0x7fbc7c00fc88>, 
#<astropy.io.fits.hdu.table.BinTableHDU object at 0x7fbc7c018080>,
#<astropy.io.fits.hdu.table.BinTableHDU object at 0x7fbc7a5975f8>,
#<astropy.io.fits.hdu.table.BinTableHDU object at 0x7fbc7a5a1438>]
afile[1].data[0][0][0][0] = 2
# ValueError: assignment destination is read-only

Is this intended behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Affects-devPRs and issues that do not impact an existing Astropy releaseBugio.fits

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions