NAME: puttran PURPOSE: Add or replace transformation solution for a given night-instrument-filter-color combination DESCRIPTION: CATEGORY: Photometry CALLING SEQUENCE: puttran,inst,date,filter,color1,color2,tran,transig,jdref, refcolor,refam,nobs,replaced,fitted,chi2,quality INPUTS: inst - Instrument code date - YYMMDD string of date of observation filter - Landolt filter code 01234 is UBVRI color1 - filter code for first color color2 - filter code for second color (uses color index of C1-C2) 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 - uncertainties corresponding to trans. jdref - Time reference point for extinction- non-zero if ktime used. 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. nobs - number of observations OPTIONAL INPUT PARAMETERS: fitted - array of ints for trans- non-zero if the corresponding values fitted, otherwise forced. If not provided the default is set, currently that all quantities are forced, except k (tran[0]). chi2 - chi-square value. If not provided the data base default is used, currently 0.0 quality - quality flag, a string containing any of the enum values recognized by the database, currently one of 'unknown','bad','suspect','good' If not provided the data base default is used,currently 'unknown' An additional special value is supported, 'default', that when supplied causes the following actions: old quality action ----------------------------- bad keep value good keep value unknown ask for new value suspect ask for new value not posted yet ask for value KEYWORD INPUT PARAMETERS: DATABASE - Name of MYSQL database for transformation search. The default is 'phot'. If TABLENAME specifies a database via the '.' notation, this keyword (as well as its default) is ignored. TABLENAME- Name of table in MYSQL database for transformation search. The default is 'transf'. If string is of the form 'a.b' then a is taken to be the name of the database and b is the tablename. Note that if neither TABLENAME nor DATABASE is specified the photometry table is located at 'phot.transf' OVERWRITE- flag, if set, an existing record with the instrument, date, filters and color will be replaced. Otherwise it is flagged as an error. REMOVE - flag, if set, any record tagged by inst, date, filter, color1, color2 is removed. SILENT - ordinarily a flag, if set, failures are silent. If set to negative values, debugging verbosity is enabled. VERBOSE - flag, if set, prints information including all db queries. OUTPUTS: replaced - set to 1 if a previous entry for inst, date, filter, color1 and color2 already existed and was replaced, 0 if a new entry was created, -1 if there was an error reported internally by puttran, -2 if there was an error reported by MYSQL. If the REMOVE flag is set, it is set 0 if there was no entry to remove, 1 if an entry was removed, and -1 if there was an error reported by puttran, -2 if there was an error reported by MYSQL. KEYWORD OUTPUT PARAMETERS: COMMON BLOCKS: SIDE EFFECTS: RESTRICTIONS: Using a value in an enum field (currently only quality) that is not one of the defined value strings creates a record that is hard to deal with. Comments cannot be added with PUTTRAN. PROCEDURE: MODIFICATION HISTORY: 2006/4/07 - Written by Peter L. Collins, Lowell Observatory for MYSQL operation. 2006/10/04, PLC, modified to write all values to transf without reference to data base names. Previous matching errors in the order of the fitted array, were corrected in puttran, gettran and the transf table of the phot database. 2006/12/19, MWB, modified behavior driven by value of quality 2006/12/27, PLC, rationalization of data base keywords. 2010/07/29, MWB, cleanup of mysql insert string. 2014/03/05, MWB, added refcolor, refam, and full second-order terms WARNING! The calling sequence is different.