[fitsbits] Is this legal FITS?

Tom McGlynn tom.mcglynn at nasa.gov
Tue Jul 25 08:54:47 EDT 2017


 From the Draft V4 standard (though this likely hasn't changed):

The NAXISn keywords must be present for
all values n = 1, ..., NAXIS, in increasing order of n, and
for no other values of n.

So having NAXIS=2 along with an NAXIS3 keyword unequivocally breaks the 
standard.  What various
libraries doe reading it is presumably undefined.

     Tom


Thompson, William T. (GSFC-671.0)[ADNET SYSTEMS INC] wrote:
> Folks:
>
> I was handed a couple of FITS files that our IDL software was having 
> trouble reading.  I was told that these FITS files were produced by 
> DS9.  Looking inside the files, I find the following keywords:
>
> SIMPLE  =                    T / Fits standard
> BITPIX  =                  -32 / number of bits per data pixel
> NAXIS   =                    2 / number of data axes
> NAXIS1  =                  360 / length of data axis 1
> NAXIS2  =                  180 / length of data axis 2
> NAXIS3  =                    0 / length of data axis
>
> Our software was choking on the NAXIS3 = 0 entry.  We tried several 
> IDL routines written by different people over the years, but all of 
> them had problems.  My question is, is it even legal to have an NAXIS3 
> keyword if NAXIS=2?  The documentation states:
>
>> If NAXIS is equal to 0, there
>> shall not be any NAXISn keywords.
>
> To my mind, that infers that there should never be any NAXISn keywords 
> for values of n greater than NAXIS.
>
> Also, according to the documentation,
>
>> A value of zero for any of
>> the NAXISn signifies that no data follow the header in the HDU
>> (however, the random groups structure described in Sect. 6 has
>> NAXIS1 = 0, but will have data following the header if the other
>> NAXISn keywords are non-zero).
>
> However, these files did contain image data after the header.  One can 
> argue that the NAXIS3 keyword is meaningless, but the fact that it 
> shows up in the header with a value of 0 does make it potentially look 
> like there shouldn't be a data part to the HDU.
>
> I was able to render these files readable in our software by changing 
> the value of NAXIS3 to 1 instead of 0.  I can modify at least one IDL 
> reader to work with these files without modification, but I do have 
> doubts about these files being properly formatted.
>
> Bill Thompson
>



More information about the fitsbits mailing list