[fitsbits] Abuse of EXTEND keyword

William Pence pence at milkyway.gsfc.nasa.gov
Fri Aug 24 14:39:58 EDT 2007


This mention of the NEXTEND keyword caused me to rethink what is really 
meant by EXTEND = F:  EXTEND = T is defined to mean that the FITS file 
*is permitted* to have extensions following the primary array (the 
actually wording in the Standard is "may contain extensions" ); it does 
not mean that the file actually has any extensions.

If EXTEND = F, then this logically means the opposite, i.e., that the 
FITS file is *not permitted* to have any extensions.  But this is not 
the meaning that the STEREO mission folks really intended by setting 
EXTEND = F since they surely don't care if users were to add extensions 
to the files at a later date.  In fact, I can't think of any case where 
it would really be appropriate to set EXTEND = F.  Instead, I think the 
desired meaning can be expressed by this pair of keywords:

EXTEND  = T
NEXTEND = 0

which means that the file currently has no extensions following the 
primary array, but it is permitted to add extensions if desired.  I'm 
not really recommending this, however, because as previously mentioned 
by Preben Grosbol, it could become a burden to keep the NEXTEND keyword 
up to date as extensions get added or removed from the file.  Instead, 
if software needs to know if there are extensions in the file then it 
can just do an inventory of the file in real time.  This is not a time 
consuming operation since it does not require reading the whole file; 
the software can directly jump to the header of each subsequent 
extension, at least on random access storage devices.

Bill Pence

Randall Thompson wrote:
> I agree with Tim, defining EXTEND=F to mean the same thing as
> EXTEND=T makes it worthless, and at that point maybe it should
> just be deprecated. You are basically saying that EXTEND=F,
> EXTEND=T, or leaving it out completely all mean the same thing;
> namely, extensions may or may not exist.
> 
> By the way, we get many files delivered for archiving within MAST
> that use both the EXTEND and the NEXTEND keyword. Although not a
> reserved keyword, NEXTEND is commonly used to describe the
> number of included extensions. I guess we are in the minority on this,
> but when these keywords disagree with the file contents we either
> correct them or ask the contributors to do it. I don't know if either
> is really useful for a FITS reader, but they can be useful for getting
> an idea of the file structure when just reading the primary header.
-- 
____________________________________________________________________
Dr. William Pence                       pence at milkyway.gsfc.nasa.gov
NASA/GSFC Code 662       HEASARC        +1-301-286-4599 (voice)
Greenbelt MD 20771                      +1-301-286-1684 (fax)





More information about the fitsbits mailing list