In order to allow FITS readers that are unfamiliar with an extension to skip it, a header must specify the size of the extension in bits. To do so, two parameters, PCOUNT and GCOUNT, are defined in the header:
The PCOUNT and GCOUNT keywords may appear anywhere between
the last NAXISn (or NAXIS=0) keyword
and the END keyword. The best place is immediately after the last
NAXISn keyword; the existing standard extensions
require that location, but otherwise software to read FITS files should
not assume they will be there. They may be defined in any way that, along
with the BITPIX, NAXIS, and NAXISn
values, gives the correct data size using the following formula to derive
NBITS, the number of bits excluding fill:
|NBITS =||ABS(BITPIX) × GCOUNT times|
|(PCOUNT + NAXIS1 × NAXIS2 × ... × NAXISm)||(3.9)|
The number NRECORDS of data records following the header record is then given by
|NRECORDS = INT[(NBITS + 23039) / 23040)]||(3.10)|
Rules for individual extensions may place further restrictions on the position of the PCOUNT and GCOUNT keywords.
END is always the last keyword in a header. The remainder of the record following the END keyword is filled with ASCII blanks.
The data begin at the start of the first record following the last record of the header.