The first step in setting up the NDF library to access foreign data formats is to define a name for each foreign format to be recognised, and to associate a file extension with each of these names. The file extension will be used to determine which format a file is written in.
This is done by defining the environment variable called NDF_FORMATS_IN to contain a format list, such as the following:
setenv NDF_FORMATS_IN 'FITS(.fit),FIGARO(.dst),IRAF(.imh)'
This is a comma-separated list of format specifications, where each specification consists of a format name (e.g. FITS) with an associated file extension (e.g. `.fit') in parentheses.
This list serves two purposes. First, it defines the set of formats and associated file extensions to be recognised when accessing input2 datasets. This means, for instance, that if a dataset name such as:
run66.fit
were given to the NDF library, it would recognise it as a FITS format file and try to carry out the appropriate conversion.
The list also defines a search order for foreign data formats. This means that if the dataset name supplied had been simply:
run66
then the NDF library would first look for a native format NDF with this name (i.e. in the file run66.sdf). If this was not found, it would then look for a file called run66.fit, then run66.dst and then run66.imh, stopping when the first one was found and associating the appropriate data format with it. If none of the files existed, a ``file not found'' error would result.
Note that the ability to select sections from pre-existing NDF datasets (see SUN/33) is also available when accessing foreign data files, so that entering:
run66.fit(100.050.0)
or
run66(100.0:200.0,10:512)
would result in the same actions as above to locate a suitable file
and to convert its format, with the required section then being
extracted from the converted NDF and passed to the application.
Adding Format Conversion Facilities to the NDF Data Access Library