[fitsbits] Primary & Alternate WCS Keyword Order

Rob Seaman seaman at noao.edu
Wed Jun 27 10:07:45 EDT 2012


On Jun 27, 2012, at 6:40 AM, Mark Calabretta wrote:

> Indeed, it is clear why some of these need a specific order
> (SIMPLE, XTENSION, END).
> 
> However, it is less clear why others do.  Specifically, why
> would I need to know the data format (BITPIX, NAXISj, PCOUNT,
> GCOUNT) until I have finished reading the header?
> 
> Others seem intended to facilitate one-pass sequential scanning
> (NAXIS, TFIELDS, WCSAXESa) as these define the number of
> parameterised keywords to expect.

There do appear to be some rules in the standard (and thus in fitsverify), that no longer serve a useful purpose and could perhaps be relaxed (without jeopardizing OFAF).  Around here we've expended valuable time debating the ordering of PCOUNT and GCOUNT for some data products, when both were present and otherwise correct.

Even on a streaming channel a FITS parser is likely to gobble 2880 header records using SIMPLE, XTENSION, and END as Mark calls out - and only then run through the various conditional statements on the next block of keywords to figure out the number of data records to expect.  This structural parsing is more fundamental than the semantic processing that follows.

It's more human readable to place the most fundamental keywords at the beginning of the headers, but it isn't clear that merely recommending such a practice wouldn't be enough, rather than attempting to legislate it.

Rob





More information about the fitsbits mailing list