NAME:
  rdastfc
 PURPOSE:
  Read an astrometry fit coefficient file.
 DESCRIPTION:

 CATEGORY:
  File I/O
 CALLING SEQUENCE:
 rdastfc,file,ffn,ftype,xc,yc,prot,renormfac,cra,cdec,photzp, $
            terms,coeffarr,ncoeffs,nlines
 INPUTS:
  file     - Input file name to be read.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  FNCENTERS - File with image centers.  (Default=centers.dat)

 OUTPUTS:
  Each of these ouputs are vectors or arrays.  The length of the vectors or
    the number of rows is equal to the number of fit coefficient sets in
    the file.  For arrays, the dimensions are [nlines,10]
  ffn      - File name for this fit.
  ftype    - Type of fit (eta or xi)
  xc       - X center of array
  yc       - Y center of array
  prot     - Pre-rotation of raw coordinates (degrees)
  renormfac- Renormalization factor used for solution.  If not known it
               will be set to -1
  cra      - Center right acension (radians)
  cdec     - Center declination (radians)
  photzp   - Photometric zero-point for this image.  If the value is
               99.0 the zero point has not been determined.  This will
               allow you to later compute a real magnitude from instrumental
               magnitudes on the frame.
  terms    - Term names that are used (see astterms.pro for more information).
               string vector size is [ncoeffs]
  coeffarr - Array of astrometric fit coefficients (see astterms.pro)
                array size is [nlines,ncoeffs]
  ncoeffs  - Number of fitted coefficients (scalar)
  nlines   - Number of coefficients read from file (scalar).

 KEYWORD OUTPUT PARAMETERS:
  VERSION - Version tag of file that was read.
  ERROR   - Flag, set if error found during read.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:
  All of the solutions in the file must have the same number of terms.

 PROCEDURE:
  The solution is a two-step conversion.  You start with raw coordinates
    that typically relate to the original position in the native coordinate
    system for the device.  The first transformation step is to convert
    to another system related to the first by a translation and rotation.
     e.g.   xp = (  (x-xc)*cos(prot) + (y-yc)*sin(prot) ) / renormfac
            yp = ( -(x-xc)*sin(prot) + (y-yc)*cos(prot) ) / renormfac

    The astrometric transformation then maps xp,yp to ra,dec.

 MODIFICATION HISTORY:
  1999/04/15, Written by Marc W. Buie, Lowell Observatory
  2000/01/19, MWB, added version 1.1 support (now includes photzp)
  2002/04/09, MWB, changed from Str_Sep to strsplit
  2005/06/28, MWB, fixed bug when reading an empty file.
  2009/08/04, MWB, added prot and renormfac variables thus changing the
                      calling sequence (sorry)
  2009/12/01, MWB, moved up to version 1.3, calling sequence slightly
                      different again. (terms was flagarr, some returned
                      values have a smaller rank).  Added ERROR output.