Since the purpose of the quality component in general-purpose software is to indicate (in conjunction with the bad-bits mask) whether each pixel is ``good'' or bad, it is natural to ask whether quality component information can be handled in the same way as bad pixels. The answer is ``yes''. In fact the NDF_ routines assume by default that quality information will be handled in this way, and this makes it legitimate simply to ignore the presence of quality information in most cases.
What actually happens to make this possible is that by default all access to an NDF's data and variance components implicitly takes account of the possible presence of an associated quality component. For instance, if NDF_BAD is called to determine if bad pixels may be present in an NDF's data array (see §), then an implicit check will also be made (if necessary) to see whether a quality component is also present. A further check on the bad-bits value may also be made, and all this information will be combined to determine whether bad pixels may be present.
When values are read from the data array (by mapping it for read or update access), a similar process takes place. In this case, if quality information is present, it is combined with the bad-bits value and used to insert bad pixels into the mapped data wherever the quality masking function evaluates to .FALSE.. The application accessing the data array need not know that this is happening, and can process the resulting mapped values as normal (but taking due account of the bad-pixel values). Note that no similar process takes place when values are written back to an NDF component (i.e. when any component accessed in update or write mode is unmapped); in this case the array values are transferred without interference from the quality component.
The same automatic quality masking also takes place by default when values are read from the variance component. This indicates why it may be more efficient to map both the data and variance components in a single call to NDF_MAP, e.g:
INTEGER PNTR( 2 ), EL ... CALL NDF_MAP( INDF, 'Data,Variance', '_REAL', 'READ', PNTR, EL, STATUS )
which returns a pair of pointers in the PNTR array.
By doing this, it becomes possible for NDF_MAP to access the quality
array (if it exists) only once, and insert bad pixels into both mapped