The FITS extension comprises a one-dimensional array of 80-character strings that follow FITS-header formatting rules. In the case of FITSIN and FITSDIN, each FITS extension is a verbatim copy of the FITS header of the input file. Other conversion tools like IRAF2NDF and UNF2NDF of CONVERT can also create a FITS extension in the same fashion. On export, standard conversion tools propagate the FITS extension to any FITS headers or equivalent in the foreign format. However, information which is derivable from the standard NDF components, such as the array dimensions, data units, and linear axes, replaces any equivalent headers from FITS extension.
You use your knowledge, or the writer of the specialist package provides import tools, to recognise certain FITS keywords and to attribute meaning to them, and then to move or process their values to make the specialist extensions. One such is the PREPARE task in IRAS90. Similarly, the reverse operation--exporting the extension information--can occur too, prior to converting the NDF into another data format.
KAPPA offers two simple tools for the importing and exporting of extension information: FITSIMP and FITSEXP. They both use a text file, which acts as a translation table between the FITS keyword and extension components. Starting with FITSIMP, its translation table might look like this.
ORDER_NUMBER _INTEGER ORDNUM PLATE_SCALE _REAL SCALE ! The plate scale in arcsec/mm SMOOTHED _LOGICAL FILTERED
It consists of three fields: the first is the name of the component in the chosen extension, the second is the HDS data type of that component, and the third is the FITS keyword. Optional comments can appear following an exclamation mark. So if we placed these lines in file imptable, we could create an extension called MYEXT of data type MJC_EXT (if it did not already exist) containing components ORDER_NUMBER, PLATE_SCALE, and SMOOTHED.
% fitsimp mydata imptable myext mjc_ext
Should any of the keywords not exist in the FITS extension, you'll be warned. If the extension already exists, you don't need to specify the extension data type. FITSIMP will even handle hierarchical keywords and those much-loved ING packets from La Palma.
Going in the opposite direction, the text translation file could look like this
MYEXT.ORDER_NUMBER ORDNUM(LAST) The spectral order number MYEXT.PLATE_SCALE SCALE The plate scale in arcsec/mm MYEXT.SMOOTHED FILTERED
where the first column is the `name' of the extension component to be copied to the FITS extension. The `name' includes the extension name and substructures. The second column gives the FITS keyword to which to write the value. A further keyword in parentheses instructs FITSEXP to place the new FITS header immediately before the header with that keyword. If the second keyword is absent from the translation-table record or the FITS extension, the new header appears immediately before the END header line in the FITS extension. Thus the value of ORDER_NUMBER in extension MYEXT, creates a new keyword in the FITS extension called ORDNUM, and it is located immediately prior the keyword LAST.
KAPPA --- Kernel Application Package