anchor.diff:  colmeta -name haDec dec_3
   # Fill in RA/Dec if not provided by the r-band
   replacecol ra "NULL_ra?iRA:ra"
  -replacecol ra -desc "Right Ascension"  "NULL_ra?haRA:ra"
  +replacecol ra -desc "J2000 Right Ascension with respect to the 2MASS PSC reference frame (which is consistent with ICRS to within 0.1 arcsec). The coordinate given is obtained from the astrometric measurement in the r'-band exposure. If the source is undetected in r', then the i' or H-alpha coordinate is given."  "NULL_ra?haRA:ra"
   replacecol dec "NULL_dec?iDec:dec"
  -replacecol dec -desc "Declination"  "NULL_dec?haDec:dec"
  +replacecol dec -desc "J2000 Declination. See comments for ra."  "NULL_dec?haDec:dec"
   colmeta -name posErr posErr_1
   replacecol posErr "NULL_posErr?posErr_2:posErr"
  -replacecol posErr "NULL_posErr?posErr_3:posErr"
  +replacecol posErr -desc "Astrometric fit error (RMS). Be aware that the error might be significantly larger than this near CCD edges." "NULL_posErr?posErr_3:posErr"
   # Add galactic coordinates
   addskycoords -inunit deg -outunit deg icrs galactic ra dec l b;
   
  
positive.code: addcol mergedClass -desc "See http://surveys.roe.ac.uk/wsa/www/gloss_m.html#gpssource_mergedclass" "toShort( pStar>0.899?-1:pStar>=0.699?-2:pGalaxy>=0.899?1:pGalaxy>=0.699?-3:pNoise>=0.899?0:pSaturated>=0.899?-9:NULL )"
  
  # mergedClassStat
  addcol mergedClassStat "toFloat( mean(array(rClassStat, iClassStat, haClassStat)) * sqrt(count(array(rClassStat, iClassStat, haClassStat))) )"
  
  
  # merged quality flags
  
negative.code: # sourceID (use the first non-NULL value of detectionID_1/2/3)
  addcol sourceID "detectionID_1"
  replacecol sourceID "NULL_sourceID?detectionID_2:sourceID"
  replacecol sourceID -desc "Unique identification number of the source. Identical to rDetectionID if the source was detected in the r-band; identical to iDetectionID or haDetectionID otherwise." "NULL_sourceID?detectionID_3:sourceID"
  
  # Rename RA/Dec
  colmeta -name ra ra_1
  