The detailed discussion of the bad-pixel flag above will probably have obscured what needs to be done in practice when writing a simple application, so this section is intended to redress the balance. The overall message is that the NDF_ system will look after all the details. The only golden rule to be followed is:
If you alter the values in an array component, then use NDF_SBAD to update the bad-pixel flag before unmapping it.
The following program fragment shows what action is typically required:
INTEGER PNTR1( 1 ), PNTR( 1 ), EL, NBAD LOGICAL BAD ... * Map the input array for reading and the output array for writing. CALL NDF_MAP( INDF1, 'Data', '_REAL', 'READ', PNTR1, EL, STATUS ) CALL NDF_MAP( INDF2, 'Data', '_REAL', 'WRITE', PNTR2, EL, STATUS ) * See if the mapped input array may contain bad pixels. CALL NDF_BAD( INDF1, 'Data', .FALSE., BAD, STATUS ) ... <process the data, counting new bad pixels in NBAD> ... * See if there may be bad pixels in the output array and declare their * presence/absence. BAD = BAD .OR. ( NBAD .NE. 0 ) CALL NDF_SBAD( BAD, INDF2, 'Data', STATUS ) * Unmap the arrays. CALL NDF_UNMAP( INDF1, 'Data', STATUS ) CALL NDF_UNMAP( INDF2, 'Data', STATUS )
In this example, a single input data array is being processed to produce a single output array and the application proceeds as follows:
In cases where the processing algorithm provides no clear indication of whether bad pixels may have been introduced, the application would need to err on the side of caution and set the output bad-pixel flag to .TRUE..