NAME:
  ltcrv2
 PURPOSE: (one line)
  Photometric lightcurve reductions with known transformation.
 DESCRIPTION:
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
     ltcrv2,stand,fil,jd,time,am,serial,inst,instsig,color,colorsig, $
        doobj,doser,dofil,tran,transig,jdref,refcolor,refam, $
        jdobs,tobs,std,stdsig
 INPUTS:
  stand    - String array of standard names.  (See coord.)
  fil      - String array of filter names for observations.
  jd       - Double precision array of the JD of observations.
  time     - Floating point array of the UT time of observations.
  am       - Floating point array of the airmass of observations.
  serial   - Serial number of observation.
  inst     - Instrumental magnitude
  instsig  - Uncertainty of the instrumental magnitude
  color    - Standard system color for object.
  colorsig - Uncertainty on the standard color
  doobj    - Name of object to reduce.
  doser    - Serial number of object to reduce.
  dofil    - Name of filter to reduce.
  tran     - Transformation coefficients (vector)
                tran(0) = principal extinction coefficient
                tran(1) = second order extinction coefficient
                tran(2) = color term
                tran(3) = zero-point
                tran(4) = time-dependent extinction term
                tran[5] = (f)  airmass squared term
                tran[6] = (g)  color squared term
  transig  - Uncertainty on the transformation coefficients (vector).
  jdref    - Time reference point for extinction
  refcolor - Color reference for the color term transformation.
                 This term is normally C * (B-V) or some other standard
                 color.  This formulation uses
                     C * ( (B-V) - REFCOLOR ) for the term instead.
  refam - Air mass reference for the transformation.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  APPEND   - Flag, if true, data will be appended to FILE
  BADFLAGS - Array of flags that mark data bad (if true).
  COLORNAME- Name of color used for color, colorsig (such as 'B-V').
  DATABASE - Name of MYSQL database to save reduced observations.
             The default is 'phot'. 
  DB       - Flag, if set, reduced observations will be saved to database.
  DVERBOSE-  Code for dbphot and other routines for db transaction verbosity.
  FILTNAME - String name for selected filter, default for 2=V and 3=R.
  FILE     - If supplied, the reduced lightcurve will be saved to this file.
  NOEDIT -   Flag, if set inhibits final interactive editing of fitted points.
             This keyword has no effect and is not necessary if the current
             plotting device is 'PS'.
  NOPLOT   - Flag, if set, suppresses a plot of the final lightcurve.
  NOSAVE  -  Flag, if true, will inhibit modification of files or databases.
  PLOTWIN - Plot window to use for output plots (default = current window)
  REFID -    String uniquely identifying observing run. This is used in 
             updating the data table in the phot 
             database. It must be specified if DB is used.
  TABLE    - Name of table in MYSQL database to save reduced observations.
             The default is 'data'. 
 KEYWORD OUTPUT PARAMETERS:
  BADFLAGS - Array of flags that mark data bad (if true).
  NOBS     - Number of points reduced.
 OUTPUTS:
  jdobs    - JD of observation for each point.
  tobs     - UT Time of observation for each point.
  std      - Standard magnitude.
  stdsig   - Uncertainty of the standard magnitude.
 COMMON BLOCKS:
 SIDE EFFECTS:
 Writes file of lightcurve data if FILE specified.
 Updates MYSQL database with lightcurve data if DB set.
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written: 1992 Mar 31, Marc W. Buie, Lowell Observatory.
  96/10/16 - MWB - added NOPLOT keyword
  96/01/24, MWB, added BADFLAGS
 2006/08/10, Peter L. Collins, Lowell Observatory, add data base
             output for reduced obs, dbphot, slight header and print cleanup.
 2006/09/26, PLC, add INSTRUMENT keyword to pass through to dbphot.
 2006/10/16, PLC, add NOSAVE keyword.
 2006/12/07, PLC, replace instrument and rundate keywords by REFID and
                   change calls to dbphot.
 2006/12/14, MWB, added PLOTWIN keyword.
 2006/12/28, PLC, added DVERBOSE keyword.
 2007/02/15, PLC, added NOBS and COLORNAME keywords. Include color in 
                  photometry database. Somewhat better editing options for
                  badflags with markdata.
 2014/03/06, MWB, added refcolor and refam (this changes the calling sequence)
                     added support for extra transformation terms
                     non-DB functions are deprecated