[AstroPy] Unable to Save Compressed HDU

Harsh Mathur harshmathur.1990 at gmail.com
Wed Jan 30 03:41:55 EST 2019


Hi,
I have a fits file which normally takes around 132 MB. I want to save it
with compressed HDU.

I tried both with astropy and sunpy, but for some reason it is not working.
To be specific, it is saving empty HDU (i.e. the grid is only filled with
nans).

Here's what I did with astropy:

from astropy.io import fits
header_object = self._get_header_object(header)
comp_hdu = fits.CompImageHDU(data=data, header=header_object)
comp_hdu.writeto(filename, output_verify='fix')

Here's what I did with sunpy:
import sunpy.io.fits
sunpy.io.fits.write(
            filename,
            data,
            header,
            hdu_type=fits.CompImageHDU
        )

I tried to debug using ipdb and checked just before the save instruction,
the data and header are present and not empty, just that its not saving.

The worst thing is, there is no error for me debug. Any help is appreciated.

Thank you in advance.

Regards
Harsh Mathur
harshmathur.1990 at gmail.com

*“Perseverance is the hard work you do after you get tired of doing the
hard work you already did."*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20190130/d5bb0ea4/attachment.html>


More information about the AstroPy mailing list