next up previous
Next: Writing Format Conversion Utilities
Up: SETTING UP FOR FORMAT CONVERSION
Previous: Defining Conversion Commands

Accessing Sub-structures Within Foreign Data Files   

The native HDS format allows multiple NDFs to be stored within a single disk file, and some foreign data formats provide somewhat similar facilities. As a concrete example, the FITS format allows images to be stored within image extensions, so a single FITS file may contain several images, each of which can be thought of as a foreign format NDF. When an NDF application is run, a specific NDF within such a FITS file can be selected by appending a foreign extension specifier (FXS) to the end of the file name. A foreign extension specifier consists of a string delimited by matching square brackets. The string identifies a sub-structure within the specified file, using syntax specific to the data format. So, for instance, the second image extension within a FITS file called m51.fit could be specified using the string ``m51.fit[2]''. Here, the sub-string ``[2]'' forms the foreign extension specifier, and uses the syntax expected by the CONVERT application FITS2NDF.

The foreign extension specifier is made available to external commands using a message token called fxs. Since this will certainly include square brackets (and possibly other non-alphanumeric characters), it cannot safely be included directly within the name of a file. You may want to do this for instance, when setting up the NDF_KEEP_ or NDF_TEMP_ environment variables. For this reason, a ``cleaned'' version of the foreign extension specifier is also available, in a message token called fxscl. This is equal to fxs except that all non-alphanumeric characters are replaced by underscores.

Note, currently the NDF library only allows foreign extension specifiers to be given when accessing existing NDFs for read-only access. An error will be reported if an FXS is included in the name of an NDF to be created, or an existing NDF for which update or write access is required.


next up previous
Next: Writing Format Conversion Utilities
Up: SETTING UP FOR FORMAT CONVERSION
Previous: Defining Conversion Commands


Starlink System Note 20
R.F.Warren-Smith & D.S.Berry
17th July 2000
E-mail:ussc@star.rl.ac.uk

Copyright © 2000 Council for the Central Laboratory of the Research Councils