How lenient should a FITS reader be?

Barry M. Schlesinger bschlesinger at nssdca.gsfc.nasa.gov
Thu Mar 14 15:43:00 EST 1996


In article <199602282217.RAA05750 at tetra.gsfc.nasa.gov>, William Pence <pence at tetra.gsfc.nasa.gov> writes...
>  [Larry Hutchinson asked ...]
>> The fits user's guide (3.1) says that a string value has a ' in column 11.
>> However, in testing a FITS reader I am writing for Igor Pro 3.0, I
>> have found a 
>> file that has certain strings starting in column 12. 
>> 				...
>> Should the reader try to accommodate screwups or is this a rare bad file?  
>> 
>> Anything else I sould be aware of?
>> 
>> 
> 
>There was a similar thread of messages on this topic in this news group
>last December.  Those format rules you refer to only strictly apply to the
>'required' FITS keywords.  It is recommended that other FITS keywords
>also follow these format rules, but in fact any format that is
>consistent with list-directed read operations in Fortran-77 is
>allowed.   Thus, for example, all of the following keywords are legal:
> 
>STRING1 = 'DOG     '           / It's an animal
>STRING2 =     'DOG    ' / It's an animal
>STRING3 =     'DOG   '       It's an animal
>STRING4 = 'DOG'It's an animal
> 
>INTEGER1=                 -273 / absolute zero
>INTEGER2= -273     / absolute zero
>INTEGER3=    -273 absolute zero
> 
>LOGICAL1=                    T / a true value
>LOGICAL2= T /a true value
>LOGICAL3=   T a true value
> 
>FLOAT1  =       12345.67890123 / 10 times greater than expected
>FLOAT2  = 1.234567890123D+04            /      10 times greater than expected
>FLOAT3  = 1234.567890123       10 times greater than expected
> 

That said, nevertheless it is considered good practice to use the 
fixed format if at all possible.  A sample case where it is 
impossible would be a double precision floating point number that is
too long to fit into columns 11-30 as would be required by the fixed
format.  To read all proper FITS files, FITS readers must be prepared
to accept any format for user-defined keywords consistent with
list-directed read; however FITS writers will simplify the task of the 
reader if they use the fixed format when they can.  The flexibility in
FITS is there to permit its extension to situations not originally
specifically envisioned, not to encourage a free-form approach to 
header design; when the conventional and recommended forms 
can be used, they should be.

				Barry Schlesinger
				FITS Support Office
				GSFC/ADF





More information about the fitsbits mailing list