Subject: Legal line in header???

From: GROTH at pupgg.princeton.edu (Edward J. Groth 609-258-4361)
Date: 8 Oct 91 21:35:47 GMT

I've just come across a FITS header with a line of the following
form:

IDENT4  = R.A 00H  -19 DEC +89 /title of map

I thought what could follow an equals sign was T, F, a legal
integer, a legal floating point number with exponent field if
desired, or alphanumeric data enclosed in ' '.

If so, the above line is illegal.  

So, is the line legal or not.  If it's legal, what are the syntax
rules for header lines.

				- Ed

/----------------------------------------------------------------------\
| Edward J. Groth            | Phone: 609-258-4361                     |
| Physics Dept., Jadwin Hall | Fax:   609-258-1124                     |
| Princeton University       | SPAN/HEPNET:  PUPGG::GROTH=44117::GROTH |
| Princeton, NJ 08544        | Internet:     groth at pupgg.princeton.edu |
\----------------------------------------------------------------------/

---

From: bschlesinger at nssdcb.gsfc.nasa.gov (Barry Schlesinger)
Date: 9 Oct 91 17:11:00 GMT

In article <15029 at princeton.Princeton.EDU>, groth at pupgg.princeton.edu writes...
>So, is the line legal or not.  If it's legal, what are the syntax

	The fixed format for keyword value, defined in the original
FITS paper, is strictly required only for mandatory keywords.  Such 
keywords would include the required keywords for the primary header, 
the keywords required by the agreement on generalized extensions, and 
the keywords required for individual extension types.  For other 
keywords, the fixed format is not required but strongly recommended.
	As a matter of practice, I would urge that the fixed format be 
used except in cases where it is clearly impossible to do so, such as 
a double precision floating point number in exponential form that 
requires more that 20 columns. 
	For the case in question, strictly speaking, the line is
permissible.  It appears to be intended to be a character string.  In
that case, I would urge the writers to reorganize the value in a way
that allows them to surround it with quotes.  (Another, somewhat
obscure, interpretation is that the entire field starting in column 9
is a comment.  If the keyword has a value, than column 9 must contain
an equal sign. However, the presence of an equal sign in column 9 does
not require that the keyword have a value!  I would strongly recommend
against putting an equal sign in column 9 when there is no value,
because it will lead to confusion.) 
	So in summary, I would say that the line is "legal".  But not 
everything that is legal is good practice.
				Barry Schlesinger
				NSSDC/NOST FITS Support Office

---

From: dwells at fits.cx.nrao.edu (Don Wells)
Date: Wed, 9 Oct 1991 22:13:40 GMT

In article <9OCT199112110371 at nssdcb.gsfc.nasa.gov>
bschlesinger at nssdcb.gsfc.nasa.gov (Barry Schlesinger) writes:

 BS> ... the case in question... appears to be intended to be a
 BS> character string.... the presence of an equal sign in column 9 ...
 BS> [FITS] does not require that the keyword have a value ... in summary, 
 BS> I would say that the line is "legal".  

I myself would say that it should be illegal for a header line to have
an equal sign in column 9 with a value field in an invalid format.
Reasonable people can easily differ about this (as Barry and I are
doing), because the FITS papers are ambiguous on this subtle point, as
on many others.

I just checked NOST-100-0.2f (14May91), the NASA draft standard for
FITS. Its wording is also somewhat ambiguous. In 5.1.1 (Syntax) it
says "if a value is present, column 9 shall contain an equal sign...
column 10 ... [a] blank, and columns 11-80 ... as specified in Section
[5.3]. If no value is present... 9-80 may contain any ASCII text."
(actually 5.1.1 says the "remainder" of 5.2, but I think it really
means 5.3 --- this should be checked). While 5.1.1 does not explicitly
say that an = in 9 *requires* a valid value, it does seem to me that
that is the most plausible reading of the wording. The wording of
5.1.2.2 (Value Indicator (bytes 9-10)) is consistent with this
interpretation.  Section 5.2.3.1 (Additional Keywords, Requirements)
also appears to be consistent, but is somewhat more ambiguous. The
wording of 5.3 (Value), interpreted in the context of the whole of
Section 5 (Headers), is clearly restricting value fields to 5 possible
formats with syntactic rules taken from Fortran-77 list-directed READ:
string ('-quoted), logical, integer, float and complex (two floats),
with /-delimited comments.

I cannot think of any future expansion need that would make it useful
to allow arbitrary strings behind an equal sign in column 9.

I recommend that the NOST Technical Panel review this technical point,
and provide an explicit rule in Sections 5.x of NOST-100-x.x.

--

Donald C. Wells             Associate Scientist        dwells at nrao.edu
National Radio Astronomy Observatory                   +1-804-296-0277
520 Edgemont Road                                 Fax= +1-804-296-0278
Charlottesville, Virginia 22903-2475 USA            78:31.1W, 38:02.2N

---

From: dwells at fits.cx.nrao.edu (Don Wells)
Date: Thu, 10 Oct 1991 19:48:57 GMT

In article <DWELLS.91Oct9171340 at fits.cx.nrao.edu>
dwells at fits.cx.nrao.edu (Don Wells) writes:

 DW> I myself would say that it should be illegal for a header line to
 DW> have an equal sign in column 9 with a value field in an invalid
 DW> format.  

Barry Schlesinger has informed me that Preben Grosbol has pointed out
an exception to the interpretaton which I suggested: 

Section 5.2.2.4 ("Commentary Keywords") of the NOST document specifies
the following rule for keywords COMMENT, HISTORY and blank: "this
keyword shall have no associated value; columns 9-80 may contain any
ASCII text". This rule allows an "=" in column 9 with columns 10-80
containing an invalid format. 

I recommend that the NOST Technical Panel revise the text so that
these three cases will be an explicit exception to an explicit rule.

--