NAME:
  ccdcal
 PURPOSE:
  Batch mode image calibration program (apply bias, dark and flats)
 DESCRIPTION:

 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  ccdcal,root,num1,num2

 INPUTS:
  root - Root of image file names.  The file names are assumed to be in
            the form of root.NNN where NNN is a 3 digit number.
         This argument can also be a string array of fully formed file
            names.  If the file names include a path, then the PATH keyword
            should normally not be used since PATH will be prepended to
            the name provided in this argument.  If a string or string array
            is given for explicit names then num1 and num2 must not be
            provided.
  num1 - first image file to process, this argument can also be an explicit
            vector list of number to process.  In this case, num2 is ignored.
  num2 - last image file to process
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  CALIBFILE       : Calibration startup file.  Default is CALIBPATH/files.cal

  CALIBPATH       : Path for calibration files.  Default is PATH/calib

  DIGITS   - Optional input to indicate how many digits are in the suffix
                of the file name.  The default for this input is 0.  In this
                case it uses the ROBOCCD scheme which is three digits up
                to 999.  After that, it gets complicated, see numtoflist
                for more information.  If you were to give it a value of
                three you would get the same behavior except you won't get
                the ROBOCDD extension.  This is really designed for when
                you have four or more digits.

  KEYLIST         : Name of a file containing a correspondence list. This list
                    associates a set of standard names with the actual keyword
                    names found in a FITS file header. If this keyword is
                    omitted, a default list is used, as if a file with the
                    following contents had been supplied:
                     AIRMASS   K  AIRMASS
                     DATE      K  DATE-OBS
                     DATETMPL  T  DD-MM-YYYY
                     EXPDELTA  V  0.0
                     EXPTIME   K  EXPTIME
                     FILTER    K  FILTERS
                     FILENAME  K  CCDFNAME
                     OBJECT    K  OBJECT
                     UT        K  UT 
                    The middle column is a flag. It may be K, for Keyword,
                    T, for Template, or V, for Value. If it is V, the contents
                    of the third field on that line should make sense for the
                    name in the first field.

  KEYREQUIRED     : Optional keyword/value pair (string array).  If supplied,
                      then only those images having the keyword/value pair
                      in their headers will be processed.

  NOFLOAT         : Flag, if set will force data to be rescaled back into
                      a 2-byte integer before writing.  Note that this can
                      cause loss of information for images that have little
                      to no sky signal.

  PATH            : Optional path for raw image and calibration directory.
                    If not specified, the current directory is used.

  PREFIX          : string to prepend to output files.  If PATH=OUTPATH the
                    default is 'c_', otherwise, the default is no prefix.

  OUTPATH         : Optional path for location to write final calibrated
                    images.  Default is the current directory.

  OVERWRITE - Flag, if set will force the program to overwrite any output
                 images that already exit.  The default is to skip things
                 that are already present.  This flag would normally be used
                 only with the calibration prescription has changed.

  SILENT - Flag, if set will suppress printed output (other than errors).

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 1999 Nov 11
  2000/02/06, MWB, added .fits optional tag on file name
  2001/11/09, MWB, added support for an input list of file numbers.
  2004/05/06, MWB, now creates output directory if not present
  2004/06/26, MWB, added new string array input for root input argument.
                     Also added KEYREQUIRED and NOFLOAT keywords.
  2007/01/03, MWB, fixed problem with BSCALE and floating point images.
  2010/11/17, MWB, added SILENT keyword
  2016/05/29, MWB, added DIGITS keyword