img
7.3. BINARY TABLE EXTENSION
71
Accessing a binary table stored on a random access storage medium is straight-
forward. Since the rows of data in the main data table are fixed in size they can be
randomly accessed given the row number, by computing the offset. Once the row has
been read in, any variable-length array data can be directly accessed using the element
count and offset given by the array descriptor stored in that row.
Reading a binary table stored on a sequential access storage medium requires that
a table of array descriptors be built up as the main data table rows are read in. Once
all the table rows have been read, the array descriptors are sorted by the offset of the
array data in the heap. As the heap data are read, arrays are extracted sequentially
from the heap and stored in the affected rows using the back pointers to the row and
field from the table of array descriptors. Since array aliasing is permitted, it might be
necessary to store a given array in more than one field or row.
Variable-length arrays are more complicated than regular static arrays and might not
be supported by some software systems. The producers of FITS data products should
consider the capabilities of the likely recipients of their files when deciding whether or
not to use this format, and as a general rule should use it only in cases where it provides
significant advantages over the simpler fixed-length array format. In particular, the use
of variable-length arrays might present difficulties for applications that ingest the FITS
file via a sequential input stream because the application cannot fully process any rows
in the table until after the entire fixed-length table and potentially the entire heap has
been transmitted as outlined in the previous paragraph.
FITS Standard