NAME:
  osiclean
 PURPOSE:
  Automatic cleaning of bad and low signal data from OSIRIS XD spectrum
 DESCRIPTION:

 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  osiclean,calib,spec,bad
 INPUTS:
  calib - Calibration structure (see ldcalir for description).
  spec  - Input spectrum to be cleaned up.
  bad   - Array of flags for each point.  0=good, 1=bad.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  DVAL  - Used for cleaning a set of spectra.  This is the threshold relative
           to unity for clipping the ratio of a spectrum against the set
           average.  (default=10)

  SILENT - Flag, if set suppresses the conversational printout.

 OUTPUTS:
  bad   - Array of flags for each point.  0=good, 1=bad.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/07/08, Written by Marc W. Buie, Lowell Observatory
  98/07/22, MWB, added protection against NaN values (automatically bad).
  98/07/24, MWB, added set cleaner (when given more than one spectrum).