A problem which immediately surfaces when you start to write applications to process NDFs is how to cope with the wide variety of data structures which may be encountered. Taking account of all possible shapes and sizes, all feasible types and storage forms for NDF components, the presence or absence of bad pixels and the state (defined or undefined) of each component, the number of combinations is clearly enormous. So how can simple general-purpose applications be written to cope with all this?
In simple cases (e.g. only a single input NDF) it is possible for an application to enquire about certain NDF attributes and adapt to some extent to take account of them. In the example in §, for instance, separate algorithms were used depending on whether bad pixels might be present or not. However, even this modest degree of adaption can rapidly become complicated if there are two or more NDFs (and hence four or more combinations of bad-pixel flags) to consider.
For general-purpose software which will be heavily used, some attempt to adapt will probably be worthwhile if it leads to significantly better performance. However, it is often necessary to write very simple or ``one off'' applications with little knowledge of NDF data structures, where any need to adapt to an incoming NDF would impose an unwelcome programming burden. Such applications should nevertheless make a consistently good job of processing NDF data structures.
The problem, therefore, is how to reconcile the very diverse requirements
imposed by the complicated nature of NDF data structures with the variable,
but generally far more modest capabilities of real applications.
The solution lies in various conversion processes which allow the attributes
of NDFs to be merged and matched to the capabilities of
applications, to arrive at a compromise method of processing the information
in any particular set of NDF data structures.
As this description suggests, some loss of efficiency or information will
inevitably be involved, but this will usually be acceptably small.
In cases where the penalty is unacceptable, an application naturally has the
option of aborting with an appropriate error message.