NAME:
  mkcalib
 PURPOSE:
  Interactive program for creating CCD calibration files.
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  mkcalib
 INPUTS:
  Everything is asked for interactively
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
   FILKEY = String - FITS keyword to read to get filter code, default = FILPOS
     Note: If you have multiple filter wheels AND you have a set of keywords
           in the form KEYn where n is a single digit number and KEY is a
           static string pattern (eg., FILT_0, FILT_1, etc.), then give this
           keyword as KEY* (ex: FILT_*).  When processed, you will get a
           string back from the concatenation of all the filter strings,
           separated by '+'.
   EXPKEY = String - FITS keyword to read to get exposure time, default = EXPTIME
   JUSTMEDIAN - Flag, if set will stop processing after the initial median
                  combination of the image cube and this will be the final
                  answer.  However, this is only honored if the NORMALIZE and
                  PRESCALE flags are both set.  This should only be used if
                  the intrinsic noise level of the result can never drop
                  below 1 DN.  This flag only affects the flat field
                  processing step.  The default is sigma clipping.

   OVERSCAN = column overscan region to use for frame bias level,
                 default=[515,531]
   CROP     = region of original image to save, default=[0,511,0,511]
   DDIR     = String, name of directory where data exists.  If not provided,
                 the program will ask for it interactively.
   RDNOISE  - Read noise of CCD, e-/DN, default=10
   ROOT     = String, root of file name for data, usually YYMMDD (ut date).
                 Program will ask for this if not provided.
   SCALE - 4 element vector which, if provide, defines the region of the
           array dimensions that are used to scale the mean
           of the arrays before combining (.  If combined in this
           manner, the arrays are combined weighted by the means.
                 [x1,x2,y1,y2]  (Used for flats only.)
           These coordinates apply to the pixel locations AFTER cropping.
 OUTPUTS:
  All output is confined to files.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/01/07 - Marc W. Buie, Lowell Observatory
  96/05/24 - MWB, added PICKFILE support, various bug fixes, improvements
               to the files.cal file creation.
  96/06/08 - MWB, added DDIR and ROOT
  2000/02/06, MWB, added .fits optional tag on file name
  2000/03/14, MWB, replaced spawn,copy with new Filecopy routine.
  2000/03/24, MWB, substantial changes to make program platform independent.
  2003/10/01, MWB, converted my Filecopy call to system file_copy routine
                   converted my Filemove call to system file_move routine
                   converted my Mkdir calls to IDL file_mkdir calls
  2006/07/14, MWB, added RDNOISE keyword
  2006/07/25, MWB, slight mod to support multiple filter wheels, plus changed
                      PICKFILE calls to DIALOG_PICKFILE
  2006/07/27, MWB, added JUSTMEDIAN keyword