The astropy.io.fits
manual states, that we can use header keywords longer than 8-characters. In this case HIERARCH cards will be created. The manual also states, that if we want to store keyword-value pairs longer than 80-characters, continue cards will automatically be created.
However, in practice it seems that both definitions work only mutually exclusive, i.e. we can not create a FITS file containing a keyword value pair, where the keyword is longer than 8-characters (i.e. a HIERARCH keyword) and the value is a very long string.
An example:
from astropy.io import fits
header1 = fits.Header()
header2 = fits.Header()
header3 = fits.Header()
header1['TEST'] = 'superlongstring'*10
header2['TEST TEST'] = 'superlongstring'
header3['TEST TEST'] = 'superlongstring'*10
Here header1
and header2
will be correct, but when calling repr(header3)
or attempting to save a FITS file with such a header, the error ValueError: The keyword TEST TEST with its value is too long
is raised.
Is this an "unintended feature" of the FITS standard, i.e. can HIERARCH
keywords not be continued with CONTINUE
cards or might this be simply a bug of astropy.io.fits
?