NAME:
  refext
 PURPOSE:
  Batch mode extraction of REFNET star catalog fields in support of ASTROM
 DESCRIPTION:
 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  refext,root,startnum,finnum
 INPUTS:
  startnum - First frame number to process
  finnum   - Last frame number to process
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:

  CATPAD   - Amount of extra padding for catalog extraction in arcsec.  The
                default is zero.

  EXTLIST  - If image is a multi-extension FITS image, this list will
                force the reduction of only the extension numbers listed.
                The default is to do all the extensions, one at a time.

  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 
                *  RA        K  RA
                *  DEC       K  DEC
                *  EPOCH     K  EPOCH
                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.  Only those fields marked with '*'
                are actually used by this program.

  MAGLIM   - Limiting (faint) magnitude for catalog extraction (default=30.0)

  NODOT    - Flag, if set suppresses inserting a . in the file name

  PATH     - String, this is the name of the directory where the data are
                stored.  The actual data directory used is PATH+'/'+root.
                The default is '' (blank) and the file would be root.NNN
                which would permit putting a leading path on the root.

  PSCALE   - Scalar number, this is the scale of the image in arcsec/pixel.
                If not specified, then this program will look for the
                ASTROM information file, astrom.inf, in the current directory
                for the plate scale.  If the file does not exist, then you
                will be prompted to provide the plate scale directly.

  SCRIPT   - String, if provided is the file name to save a script to.
                If set will suppress the actual call to refnet to
                generate the star sub-catalogs.  Instead, all the calls
                to refnet will be saved to this file.

  NOBINARY - Flag, if set will suppress automatically promoting the ASCII
                catalog files to the binary format.

 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  97/11/13 - Original version written by Gerbs Bauer, Institute for Astronomy
  97/11/14, MWB, stylistic rewrite
  98/03/25, MWB, add EXTLIST keyword and group extension support
  98/04,    MWB, changed readfits to fits_read.
  99/06/21, MWB, added NODOT keyword
  2000/02/05, MWB, minor mod to add .fits tag support.
  2000/08/25, MWB, added CATPATH pass through for refnet.
  2001/12/07, MWB, added CATPAD (same as in astrom.pro).
  2002/02/06, MWB, removed CATPATH keyword
  2003/05/31, MWB, changed to prevent overwriting pre-existing cat files
  2007/11/30, MWB, changed to support the new binary file formats.