When an NDF is first created, all its components are in an undefined state and the bad-pixel flag values of the data and variance components are set to .TRUE.. They remain set to .TRUE. until evidence is presented that values have been assigned to either of these components which do not contain any bad pixels. This information can normally only come from the application which assigns the values, so the routine NDF_SBAD is provided to explicitly set the bad-pixel flag value when appropriate. For instance:
CALL NDF_SBAD( .FALSE., INDF, 'Data', STATUS )
constitutes a declaration by the calling routine that the data component of an NDF does not currently contain any bad pixels. It is entirely the calling routine's responsibility to ensure that this declaration is accurate, since subsequent applications which access the NDF may otherwise be mislead. In practice, this means that it must either have generated the values itself or have checked them in some way to be sure of the absence of bad pixels.
The converse situation may also arise, where an application is forced to introduce bad pixels into an array component which previously did not contain any. In this case, it must also declare this fact if subsequent applications are not to be mislead. This time, the first (BAD) argument to NDF_BAD would be set to .TRUE.. For instance:
CALL NDF_SBAD( .TRUE., INDF, 'Data,Variance', STATUS )
Here, a simultaneous declaration for both the data and variance components has been made by specifying both component names.
If an application is uncertain whether bad pixels may have been introduced or not, then it should always err on the side of caution and set the bad-pixel flag value to .TRUE.. This is not irreversible, since separate general-purpose applications will exist to allow a user to explicitly check for bad pixels in an NDF and to adjust the bad-pixel flag if required.
Finally, note that the bad-pixel flag for the data and variance components always reverts to .TRUE. if the component is reset to an undefined state, e.g. by a call to NDF_RESET. If a component is in this state, then NDF_SBAD will return without action and the bad-pixel flag will remain set to .TRUE..