NAME:
  autocal
 PURPOSE:
  Automatic program for creating CCD calibration files.
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  autocal
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
   ASK    = flag, if set will ask if you want to delete each image in turn
               once you don't delete any images in a pass it will then
               proceed to finish.  If you delete anything, that calibration
               file will be regenerated using the modified set you have chosen.
   FILKEY = String - FITS keyword to read to get filter code, default = FILPOS
   EXPKEY = String - FITS keyword to read to get exposure time, default = EXPTIME
   TYPEKEY= String - FITS keyword to read to get exposure type, default = IMAGETYP
   OVERSCAN = column overscan region to use for frame bias level,
                 default=[-1,-1]
   CROP     = region of original image to save, default=[-1,-1,-1,-1]=no crop
                                                        [x1,x2,y1,y2]
   DDIR     = String, name of directory where data exists.  If not provided,
                 the program assumes the current directory.
   ROOT     = String, root of file name for data, usually YYMMDD (ut date).
                 Default is the last part of DDIR.
   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.
   BINFAC   - binning factor for display of final products (default=1)
  PATTERN - File searching pattern, default=root+'*.???'
   RDNOISE  - Read noise of CCD [in DN], default=10

 OUTPUTS:
  All output is confined to files.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  2001/02/15 - Marc W. Buie, Lowell Observatory
  2001/03/19, MWB, fixed file name bug.
  2001/04/24, MWB, fixed problem with incomplete flat sets on a night.
  2001/09/25, MWB, forced imagetyp field to be lower case.
  2003/10/01, MWB, converted my Filemove call to system file_move routine
                   converted my Mkdir calls to IDL file_mkdir calls
  2003/11/05, MWB, changed file search pattern to get YYMMDD*.???
                       (the * is new)
  2004/9/21, MWB, removed obsolete call to Findfile
  2005/4/1, MWB, modified for new version of MKDARK
  2005/10/26, MWB, added PATTERN keyword
  2006/03/15, MWB, added BINFAC keyword
  2007/05/08, MWB, removed unused FILNAMEKEY keyword, modified FILKEY to use
                     multiple filters (ie., FILKEY='FILTER*')
  2008/01/22, MWB, added RDNOISE keyword.