This section presents an overview of what NDF data structures are, and the facilities which the NDF_ system provides for manipulating them.
The simplest way of regarding an NDF is to view it as a collection of those items which might typically be required in an astronomical image or spectrum. The main part is an N-dimensional array of data (where N is 1 for a spectrum, 2 for an image, etc.), but this may also be accompanied by a number of other items which are conveniently categorised as follows:
Character components: | TITLE — | NDF title |
LABEL — | Data label | |
UNITS — | Data units | |
Array components: | DATA — | Data pixel values |
VARIANCE — | Pixel variance estimates | |
QUALITY — | Pixel quality values | |
Miscellaneous components: | AXIS — | Coordinate axes |
WCS — | World coordinate systems | |
HISTORY — | Processing history | |
Extensions: | EXTENSION — | Provides extensibility |
The names of these components are significant, since they are used by the NDF access routines to identify the component(s) to which certain operations should be applied.1 The following describes the purpose and interpretation of each component in slightly more detail.
Character components:
Array components:
Miscellaneous components:
The WCS component is a rather more complex entity than most other NDF components and a full description is currently beyond the scope of this document. It stores world coordinate information in a format defined by the AST library (see SUN/210) and known as a “FrameSet”. You should consult SUN/210 for a full description of the facilities which a FrameSet provides. The NDF_ library simply provides routines for reading and writing this information (see NDF_GTWCS and NDF_PTWCS).
Extensions:
The NDF access routines described in this document all have names of the form:
NDF_name
where name identifies the operation which the routine performs. These routines provide facilities for performing the following types of operation on NDF data structures:
A full description of each routine can be found in Appendix D of this document.
The NDF_ routines adhere throughout to the standard error-handling strategy described in SUN/104. Most of the routines therefore carry an integer inherited status argument called STATUS and will return without action unless this is set to the value SAI__OK3 when they are invoked. When necessary, error reports are made through the ERR_ routines in the manner described in SUN/104. Where exceptions to this general behaviour exist, they are noted in the appropriate subroutine descriptions in Appendix D.
The following contains an example of a simple application which uses the NDF_ routines to add the data arrays of two NDF data structures to produce a new NDF. This is not quite the simplest “add” application which could be written, but is close to it. Nevertheless, it will do a good job, and will respond correctly to unforseen circumstances or conditions which it is not designed to handle by issuing sensible error messages.
The intention here is simply to give a flavour of how the NDF_ routines are used, so don’t worry if you don’t understand all the details. The example is followed by some brief programming notes which include references to other relevant sections of this document which can be consulted if necessary. If you are interested, a more sophisticated “add” application with extra commentary can also be found in §A.7.
Programming notes:
1Note that the name “DATA” used by the NDF_ routines to refer to an NDF’s data component differs from the actual name of the HDS object in which it is stored, which is “DATA_ARRAY”.
2In this respect, the WCS component provides a superset of the facilities provided by the AXIS component. However, the AXIS component is retained because it has been used historically by a significant number of astronomical applications. The NDF_ library maintains consistency between these two components (to the extent that their nature allows). Thus, for example, the rectangular coordinate system defined by the AXIS component is also accessible through the WCS component.
3The symbolic constant SAI__OK is defined in the include file SAE_PAR.