Subject: ASCII tables, practical interpretation

From: sla at umbra.ucolick.org (Steve Allen)
Date: 22 Oct 1996 22:48:34 GMT

Many of the existing FITS ASCII tables consist of catalogs which were
converted from non-FITS files.  The treatment of NULL values in such
files is not entirely uniform, and neither are the needs of FITS
reading programs.  It helps to have some conventions about the
interpretation of data which address both.

Here is a (probably arguable) truth table:
++++++++
Reading a value out of a FITS ASCII table

This applies when TTYPEn is one of (Iw, Dw.d, Ew.d, Fw.d).
(If TTYPEn is Aw then the field content is always "legal".)

field   || TNULLn exists and  | otherwise
content || field matches it   |
========##====================#==============
blank   ||       NULL         | NULL      (1)
--------++ - - - -  - - - - - +--------------
legal   ||       NULL         | use field (2)
--------++ - - - -  - - - - - +--------------
illegal ||       NULL         | ERROR     (3)
--------++--------------------+--------------

The cases marked () deserve a little closer inspection.

(1)
The FORTRAN parsing semantics which are specified by the FITS papers
would force the interpretation of a blank field to be numeric ZERO.
Nonetheless, in many of the converted catalogs it is clear that the
intent of the authors should have been to insert a TNULLn = ' ' card
so that the blanks would be interpreted as a NULL.  It seems unlikely
that original table authors would not insert an explicit zero for a
field whose value was zero.  This means that the default Fortran
interpretation (ZERO) is probably not the right thing to assume.

Depending on the application it may be desirable to have an option
which permits this case to be flagged as ERROR.

(2)
In the case where TTYPEn = 'Aw' and the datatype is actually
transmitting a LOGICAL value the arguments about point (1)
and (3) apply at a later stage, but this is not within the
scope of the interpretation of FITS.

(3)
Depending on the application it may be desirable to have an option
which permits this case to be flagged as NULL.
++++++++

I have used the above truth table for the ingestion of ASCII tables
into a relational database.  It may be useful for reference or
discussion.
--
Steve Allen          UCO/Lick Observatory       Santa Cruz, CA 95064
sla at ucolick.org      Voice: +1 408 459 3046     FAX: +1 408 454 9863
WWW: http://www.ucolick.org/~sla                PGP public keys:  see WWW