[fitsbits] Is this legal FITS?

William Pence William.Pence at nasa.gov
Mon Jul 24 16:33:03 EDT 2017


In this case (with NAXIS = 2), the NAXIS3 keyword is not legal according 
to section 4.4.1.1 of the FITS standard:

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

On the other hand, I wouldn't have expected software to choke on such a 
minor infraction, regardless of the value of the NAXIS3 keyword.

-Bill


On 07/24/2017 03:22 PM, 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
> 


-- 
____________________________________________________________________
Dr. William Pence    Astrophysicist     William.Pence at nasa.gov
NASA/GSFC Code 662     [Emeritus]       +1-301-286-4599 (voice)
Greenbelt MD 20771                      +1-301-286-1684 (fax)




More information about the fitsbits mailing list