IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 2, 2006, 2:47:23 PM (20 years ago)
Author:
jhoblitt
Message:

VERSION 0.0.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/jhoblitt/ippdb/src/ippdb.c

    r8054 r8079  
    51305130static void newExpRowFree(newExpRow *object);
    51315131
    5132 newExpRow *newExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles)
     5132newExpRow *newExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *class)
    51335133{
    51345134    newExpRow       *object;
     
    51425142    object->exp_type = psStringCopy(exp_type);
    51435143    object->imfiles = imfiles;
     5144    object->class = psStringCopy(class);
    51445145
    51455146    return object;
     
    51525153    psFree(object->telescope);
    51535154    psFree(object->exp_type);
     5155    psFree(object->class);
    51545156}
    51555157
     
    51905192        return false;
    51915193    }
     5194    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "64")) {
     5195        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     5196        psFree(md);
     5197        return false;
     5198    }
    51925199
    51935200    status = psDBCreateTable(dbh, NEWEXP_TABLE_NAME, md);
     
    52035210}
    52045211
    5205 bool newExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles)
     5212bool newExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *class)
    52065213{
    52075214    psMetadata      *md;
     
    52345241        return false;
    52355242    }
     5243    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {
     5244        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     5245        psFree(md);
     5246        return false;
     5247    }
    52365248
    52375249    status = psDBInsertOneRow(dbh, NEWEXP_TABLE_NAME, md);
     
    52415253}
    52425254
    5243 bool newExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles)
     5255bool newExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **class)
    52445256{
    52455257    psArray         *rowSet;
     
    53155327        return false;
    53165328    }
     5329    *class = psMetadataLookupPtr(&status, row, "class");
     5330    if (!status) {
     5331        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     5332        psFree(row);
     5333        return false;
     5334    }
    53175335
    53185336    psFree(row);
     
    53235341bool newExpInsertObject(psDB *dbh, newExpRow *object)
    53245342{
    5325     return newExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles);
     5343    return newExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->class);
    53265344}
    53275345
     
    53335351    char            exp_type[256];
    53345352    psS32           imfiles;
    5335 
    5336     if (!newExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles)) {
     5353    char            class[256];
     5354
     5355    if (!newExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&class)) {
    53375356        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    53385357        return NULL;
    53395358    }
    53405359
    5341     return newExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles);
     5360    return newExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, class);
    53425361}
    53435362
     
    54635482        return NULL;
    54645483    }
     5484    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {
     5485        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     5486        psFree(md);
     5487        return NULL;
     5488    }
    54655489
    54665490    return md;
     
    54755499    char            *exp_type;
    54765500    psS32           imfiles;
     5501    char            *class;
    54775502
    54785503    exp_id = psMetadataLookupPtr(&status, md, "exp_id");
     
    55015526        return false;
    55025527    }
    5503 
    5504     return newExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles);
     5528    class = psMetadataLookupPtr(&status, md, "class");
     5529    if (!status) {
     5530        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     5531        return false;
     5532    }
     5533
     5534    return newExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, class);
    55055535}
    55065536psArray *newExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    59615991static void rawDetrendExpRowFree(rawDetrendExpRow *object);
    59625992
    5963 rawDetrendExpRow *rawDetrendExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats)
     5993rawDetrendExpRow *rawDetrendExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time)
    59645994{
    59655995    rawDetrendExpRow *object;
     
    59746004    object->imfiles = imfiles;
    59756005    object->filter = psStringCopy(filter);
    5976     object->stats = psStringCopy(stats);
     6006    object->class = psStringCopy(class);
     6007    object->airmass = airmass;
     6008    object->ra = ra;
     6009    object->dec = dec;
     6010    object->exp_time = exp_time;
    59776011
    59786012    return object;
     
    59866020    psFree(object->exp_type);
    59876021    psFree(object->filter);
    5988     psFree(object->stats);
     6022    psFree(object->class);
    59896023}
    59906024
     
    60306064        return false;
    60316065    }
    6032     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) {
    6033         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     6066    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) {
     6067        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     6068        psFree(md);
     6069        return false;
     6070    }
     6071    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) {
     6072        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     6073        psFree(md);
     6074        return false;
     6075    }
     6076    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) {
     6077        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     6078        psFree(md);
     6079        return false;
     6080    }
     6081    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) {
     6082        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     6083        psFree(md);
     6084        return false;
     6085    }
     6086    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) {
     6087        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    60346088        psFree(md);
    60356089        return false;
     
    60486102}
    60496103
    6050 bool rawDetrendExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats)
     6104bool rawDetrendExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time)
    60516105{
    60526106    psMetadata      *md;
     
    60846138        return false;
    60856139    }
    6086     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) {
    6087         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     6140    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {
     6141        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     6142        psFree(md);
     6143        return false;
     6144    }
     6145    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) {
     6146        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     6147        psFree(md);
     6148        return false;
     6149    }
     6150    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) {
     6151        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     6152        psFree(md);
     6153        return false;
     6154    }
     6155    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) {
     6156        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     6157        psFree(md);
     6158        return false;
     6159    }
     6160    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) {
     6161        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    60886162        psFree(md);
    60896163        return false;
     
    60966170}
    60976171
    6098 bool rawDetrendExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **stats)
     6172bool rawDetrendExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time)
    60996173{
    61006174    psArray         *rowSet;
     
    61766250        return false;
    61776251    }
    6178     *stats = psMetadataLookupPtr(&status, row, "stats");
    6179     if (!status) {
    6180         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     6252    *class = psMetadataLookupPtr(&status, row, "class");
     6253    if (!status) {
     6254        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     6255        psFree(row);
     6256        return false;
     6257    }
     6258    *airmass = psMetadataLookupF32(&status, row, "airmass");
     6259    if (!status) {
     6260        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     6261        psFree(row);
     6262        return false;
     6263    }
     6264    *ra = psMetadataLookupF32(&status, row, "ra");
     6265    if (!status) {
     6266        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     6267        psFree(row);
     6268        return false;
     6269    }
     6270    *dec = psMetadataLookupF32(&status, row, "dec");
     6271    if (!status) {
     6272        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     6273        psFree(row);
     6274        return false;
     6275    }
     6276    *exp_time = psMetadataLookupF32(&status, row, "exp_time");
     6277    if (!status) {
     6278        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    61816279        psFree(row);
    61826280        return false;
     
    61906288bool rawDetrendExpInsertObject(psDB *dbh, rawDetrendExpRow *object)
    61916289{
    6192     return rawDetrendExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->stats);
     6290    return rawDetrendExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time);
    61936291}
    61946292
     
    62016299    psS32           imfiles;
    62026300    char            filter[256];
    6203     char            stats[256];
    6204 
    6205     if (!rawDetrendExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats)) {
     6301    char            class[256];
     6302    psF32           airmass;
     6303    psF32           ra;
     6304    psF32           dec;
     6305    psF32           exp_time;
     6306
     6307    if (!rawDetrendExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time)) {
    62066308        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    62076309        return NULL;
    62086310    }
    62096311
    6210     return rawDetrendExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats);
     6312    return rawDetrendExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time);
    62116313}
    62126314
     
    63376439        return NULL;
    63386440    }
    6339     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) {
    6340         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     6441    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {
     6442        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     6443        psFree(md);
     6444        return NULL;
     6445    }
     6446    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) {
     6447        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     6448        psFree(md);
     6449        return NULL;
     6450    }
     6451    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) {
     6452        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     6453        psFree(md);
     6454        return NULL;
     6455    }
     6456    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) {
     6457        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     6458        psFree(md);
     6459        return NULL;
     6460    }
     6461    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) {
     6462        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    63416463        psFree(md);
    63426464        return NULL;
     
    63556477    psS32           imfiles;
    63566478    char            *filter;
    6357     char            *stats;
     6479    char            *class;
     6480    psF32           airmass;
     6481    psF32           ra;
     6482    psF32           dec;
     6483    psF32           exp_time;
    63586484
    63596485    exp_id = psMetadataLookupPtr(&status, md, "exp_id");
     
    63876513        return false;
    63886514    }
    6389     stats = psMetadataLookupPtr(&status, md, "stats");
    6390     if (!status) {
    6391         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
    6392         return false;
    6393     }
    6394 
    6395     return rawDetrendExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats);
     6515    class = psMetadataLookupPtr(&status, md, "class");
     6516    if (!status) {
     6517        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     6518        return false;
     6519    }
     6520    airmass = psMetadataLookupF32(&status, md, "airmass");
     6521    if (!status) {
     6522        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     6523        return false;
     6524    }
     6525    ra = psMetadataLookupF32(&status, md, "ra");
     6526    if (!status) {
     6527        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     6528        return false;
     6529    }
     6530    dec = psMetadataLookupF32(&status, md, "dec");
     6531    if (!status) {
     6532        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     6533        return false;
     6534    }
     6535    exp_time = psMetadataLookupF32(&status, md, "exp_time");
     6536    if (!status) {
     6537        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
     6538        return false;
     6539    }
     6540
     6541    return rawDetrendExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time);
    63966542}
    63976543psArray *rawDetrendExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    64516597static void rawScienceExpRowFree(rawScienceExpRow *object);
    64526598
    6453 rawScienceExpRow *rawScienceExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats)
     6599rawScienceExpRow *rawScienceExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time)
    64546600{
    64556601    rawScienceExpRow *object;
     
    64646610    object->imfiles = imfiles;
    64656611    object->filter = psStringCopy(filter);
    6466     object->stats = psStringCopy(stats);
     6612    object->class = psStringCopy(class);
     6613    object->airmass = airmass;
     6614    object->ra = ra;
     6615    object->dec = dec;
     6616    object->exp_time = exp_time;
    64676617
    64686618    return object;
     
    64766626    psFree(object->exp_type);
    64776627    psFree(object->filter);
    6478     psFree(object->stats);
     6628    psFree(object->class);
    64796629}
    64806630
     
    65206670        return false;
    65216671    }
    6522     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) {
    6523         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     6672    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) {
     6673        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     6674        psFree(md);
     6675        return false;
     6676    }
     6677    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) {
     6678        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     6679        psFree(md);
     6680        return false;
     6681    }
     6682    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) {
     6683        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     6684        psFree(md);
     6685        return false;
     6686    }
     6687    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) {
     6688        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     6689        psFree(md);
     6690        return false;
     6691    }
     6692    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) {
     6693        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    65246694        psFree(md);
    65256695        return false;
     
    65386708}
    65396709
    6540 bool rawScienceExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats)
     6710bool rawScienceExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time)
    65416711{
    65426712    psMetadata      *md;
     
    65746744        return false;
    65756745    }
    6576     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) {
    6577         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     6746    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {
     6747        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     6748        psFree(md);
     6749        return false;
     6750    }
     6751    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) {
     6752        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     6753        psFree(md);
     6754        return false;
     6755    }
     6756    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) {
     6757        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     6758        psFree(md);
     6759        return false;
     6760    }
     6761    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) {
     6762        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     6763        psFree(md);
     6764        return false;
     6765    }
     6766    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) {
     6767        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    65786768        psFree(md);
    65796769        return false;
     
    65866776}
    65876777
    6588 bool rawScienceExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **stats)
     6778bool rawScienceExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time)
    65896779{
    65906780    psArray         *rowSet;
     
    66666856        return false;
    66676857    }
    6668     *stats = psMetadataLookupPtr(&status, row, "stats");
    6669     if (!status) {
    6670         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     6858    *class = psMetadataLookupPtr(&status, row, "class");
     6859    if (!status) {
     6860        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     6861        psFree(row);
     6862        return false;
     6863    }
     6864    *airmass = psMetadataLookupF32(&status, row, "airmass");
     6865    if (!status) {
     6866        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     6867        psFree(row);
     6868        return false;
     6869    }
     6870    *ra = psMetadataLookupF32(&status, row, "ra");
     6871    if (!status) {
     6872        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     6873        psFree(row);
     6874        return false;
     6875    }
     6876    *dec = psMetadataLookupF32(&status, row, "dec");
     6877    if (!status) {
     6878        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     6879        psFree(row);
     6880        return false;
     6881    }
     6882    *exp_time = psMetadataLookupF32(&status, row, "exp_time");
     6883    if (!status) {
     6884        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    66716885        psFree(row);
    66726886        return false;
     
    66806894bool rawScienceExpInsertObject(psDB *dbh, rawScienceExpRow *object)
    66816895{
    6682     return rawScienceExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->stats);
     6896    return rawScienceExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time);
    66836897}
    66846898
     
    66916905    psS32           imfiles;
    66926906    char            filter[256];
    6693     char            stats[256];
    6694 
    6695     if (!rawScienceExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats)) {
     6907    char            class[256];
     6908    psF32           airmass;
     6909    psF32           ra;
     6910    psF32           dec;
     6911    psF32           exp_time;
     6912
     6913    if (!rawScienceExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time)) {
    66966914        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    66976915        return NULL;
    66986916    }
    66996917
    6700     return rawScienceExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats);
     6918    return rawScienceExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time);
    67016919}
    67026920
     
    68277045        return NULL;
    68287046    }
    6829     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) {
    6830         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     7047    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {
     7048        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     7049        psFree(md);
     7050        return NULL;
     7051    }
     7052    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) {
     7053        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     7054        psFree(md);
     7055        return NULL;
     7056    }
     7057    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) {
     7058        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     7059        psFree(md);
     7060        return NULL;
     7061    }
     7062    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) {
     7063        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     7064        psFree(md);
     7065        return NULL;
     7066    }
     7067    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) {
     7068        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    68317069        psFree(md);
    68327070        return NULL;
     
    68457083    psS32           imfiles;
    68467084    char            *filter;
    6847     char            *stats;
     7085    char            *class;
     7086    psF32           airmass;
     7087    psF32           ra;
     7088    psF32           dec;
     7089    psF32           exp_time;
    68487090
    68497091    exp_id = psMetadataLookupPtr(&status, md, "exp_id");
     
    68777119        return false;
    68787120    }
    6879     stats = psMetadataLookupPtr(&status, md, "stats");
    6880     if (!status) {
    6881         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
    6882         return false;
    6883     }
    6884 
    6885     return rawScienceExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats);
     7121    class = psMetadataLookupPtr(&status, md, "class");
     7122    if (!status) {
     7123        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     7124        return false;
     7125    }
     7126    airmass = psMetadataLookupF32(&status, md, "airmass");
     7127    if (!status) {
     7128        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     7129        return false;
     7130    }
     7131    ra = psMetadataLookupF32(&status, md, "ra");
     7132    if (!status) {
     7133        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     7134        return false;
     7135    }
     7136    dec = psMetadataLookupF32(&status, md, "dec");
     7137    if (!status) {
     7138        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     7139        return false;
     7140    }
     7141    exp_time = psMetadataLookupF32(&status, md, "exp_time");
     7142    if (!status) {
     7143        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
     7144        return false;
     7145    }
     7146
     7147    return rawScienceExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time);
    68867148}
    68877149psArray *rawScienceExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    73727634static void p1PendingExpRowFree(p1PendingExpRow *object);
    73737635
    7374 p1PendingExpRow *p1PendingExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats, const char *recipe, psS32 p1_version)
     7636p1PendingExpRow *p1PendingExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version)
    73757637{
    73767638    p1PendingExpRow *object;
     
    73857647    object->imfiles = imfiles;
    73867648    object->filter = psStringCopy(filter);
    7387     object->stats = psStringCopy(stats);
     7649    object->class = psStringCopy(class);
     7650    object->airmass = airmass;
     7651    object->ra = ra;
     7652    object->dec = dec;
     7653    object->exp_time = exp_time;
    73887654    object->recipe = psStringCopy(recipe);
    73897655    object->p1_version = p1_version;
     
    73997665    psFree(object->exp_type);
    74007666    psFree(object->filter);
    7401     psFree(object->stats);
     7667    psFree(object->class);
    74027668    psFree(object->recipe);
    74037669}
     
    74447710        return false;
    74457711    }
    7446     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) {
    7447         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     7712    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) {
     7713        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     7714        psFree(md);
     7715        return false;
     7716    }
     7717    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) {
     7718        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     7719        psFree(md);
     7720        return false;
     7721    }
     7722    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) {
     7723        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     7724        psFree(md);
     7725        return false;
     7726    }
     7727    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) {
     7728        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     7729        psFree(md);
     7730        return false;
     7731    }
     7732    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) {
     7733        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    74487734        psFree(md);
    74497735        return false;
     
    74727758}
    74737759
    7474 bool p1PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats, const char *recipe, psS32 p1_version)
     7760bool p1PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version)
    74757761{
    74767762    psMetadata      *md;
     
    75087794        return false;
    75097795    }
    7510     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) {
    7511         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     7796    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {
     7797        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     7798        psFree(md);
     7799        return false;
     7800    }
     7801    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) {
     7802        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     7803        psFree(md);
     7804        return false;
     7805    }
     7806    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) {
     7807        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     7808        psFree(md);
     7809        return false;
     7810    }
     7811    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) {
     7812        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     7813        psFree(md);
     7814        return false;
     7815    }
     7816    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) {
     7817        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    75127818        psFree(md);
    75137819        return false;
     
    75307836}
    75317837
    7532 bool p1PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **stats, char **recipe, psS32 *p1_version)
     7838bool p1PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time, char **recipe, psS32 *p1_version)
    75337839{
    75347840    psArray         *rowSet;
     
    76107916        return false;
    76117917    }
    7612     *stats = psMetadataLookupPtr(&status, row, "stats");
    7613     if (!status) {
    7614         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     7918    *class = psMetadataLookupPtr(&status, row, "class");
     7919    if (!status) {
     7920        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     7921        psFree(row);
     7922        return false;
     7923    }
     7924    *airmass = psMetadataLookupF32(&status, row, "airmass");
     7925    if (!status) {
     7926        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     7927        psFree(row);
     7928        return false;
     7929    }
     7930    *ra = psMetadataLookupF32(&status, row, "ra");
     7931    if (!status) {
     7932        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     7933        psFree(row);
     7934        return false;
     7935    }
     7936    *dec = psMetadataLookupF32(&status, row, "dec");
     7937    if (!status) {
     7938        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     7939        psFree(row);
     7940        return false;
     7941    }
     7942    *exp_time = psMetadataLookupF32(&status, row, "exp_time");
     7943    if (!status) {
     7944        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    76157945        psFree(row);
    76167946        return false;
     
    76367966bool p1PendingExpInsertObject(psDB *dbh, p1PendingExpRow *object)
    76377967{
    7638     return p1PendingExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->stats, object->recipe, object->p1_version);
     7968    return p1PendingExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time, object->recipe, object->p1_version);
    76397969}
    76407970
     
    76477977    psS32           imfiles;
    76487978    char            filter[256];
    7649     char            stats[256];
     7979    char            class[256];
     7980    psF32           airmass;
     7981    psF32           ra;
     7982    psF32           dec;
     7983    psF32           exp_time;
    76507984    char            recipe[256];
    76517985    psS32           p1_version;
    76527986
    7653     if (!p1PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats, (char **)&recipe, &p1_version)) {
     7987    if (!p1PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time, (char **)&recipe, &p1_version)) {
    76547988        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    76557989        return NULL;
    76567990    }
    76577991
    7658     return p1PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version);
     7992    return p1PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version);
    76597993}
    76607994
     
    77858119        return NULL;
    77868120    }
    7787     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) {
    7788         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     8121    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {
     8122        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     8123        psFree(md);
     8124        return NULL;
     8125    }
     8126    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) {
     8127        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     8128        psFree(md);
     8129        return NULL;
     8130    }
     8131    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) {
     8132        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     8133        psFree(md);
     8134        return NULL;
     8135    }
     8136    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) {
     8137        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     8138        psFree(md);
     8139        return NULL;
     8140    }
     8141    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) {
     8142        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    77898143        psFree(md);
    77908144        return NULL;
     
    78138167    psS32           imfiles;
    78148168    char            *filter;
    7815     char            *stats;
     8169    char            *class;
     8170    psF32           airmass;
     8171    psF32           ra;
     8172    psF32           dec;
     8173    psF32           exp_time;
    78168174    char            *recipe;
    78178175    psS32           p1_version;
     
    78478205        return false;
    78488206    }
    7849     stats = psMetadataLookupPtr(&status, md, "stats");
    7850     if (!status) {
    7851         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     8207    class = psMetadataLookupPtr(&status, md, "class");
     8208    if (!status) {
     8209        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     8210        return false;
     8211    }
     8212    airmass = psMetadataLookupF32(&status, md, "airmass");
     8213    if (!status) {
     8214        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     8215        return false;
     8216    }
     8217    ra = psMetadataLookupF32(&status, md, "ra");
     8218    if (!status) {
     8219        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     8220        return false;
     8221    }
     8222    dec = psMetadataLookupF32(&status, md, "dec");
     8223    if (!status) {
     8224        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     8225        return false;
     8226    }
     8227    exp_time = psMetadataLookupF32(&status, md, "exp_time");
     8228    if (!status) {
     8229        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    78528230        return false;
    78538231    }
     
    78638241    }
    78648242
    7865     return p1PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version);
     8243    return p1PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version);
    78668244}
    78678245psArray *p1PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    79218299static void p2PendingExpRowFree(p2PendingExpRow *object);
    79228300
    7923 p2PendingExpRow *p2PendingExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats, const char *recipe, psS32 p1_version, psS32 p2_version)
     8301p2PendingExpRow *p2PendingExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version, psS32 p2_version)
    79248302{
    79258303    p2PendingExpRow *object;
     
    79348312    object->imfiles = imfiles;
    79358313    object->filter = psStringCopy(filter);
    7936     object->stats = psStringCopy(stats);
     8314    object->class = psStringCopy(class);
     8315    object->airmass = airmass;
     8316    object->ra = ra;
     8317    object->dec = dec;
     8318    object->exp_time = exp_time;
    79378319    object->recipe = psStringCopy(recipe);
    79388320    object->p1_version = p1_version;
     
    79498331    psFree(object->exp_type);
    79508332    psFree(object->filter);
    7951     psFree(object->stats);
     8333    psFree(object->class);
    79528334    psFree(object->recipe);
    79538335}
     
    79948376        return false;
    79958377    }
    7996     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) {
    7997         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     8378    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) {
     8379        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     8380        psFree(md);
     8381        return false;
     8382    }
     8383    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) {
     8384        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     8385        psFree(md);
     8386        return false;
     8387    }
     8388    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) {
     8389        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     8390        psFree(md);
     8391        return false;
     8392    }
     8393    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) {
     8394        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     8395        psFree(md);
     8396        return false;
     8397    }
     8398    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) {
     8399        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    79988400        psFree(md);
    79998401        return false;
     
    80278429}
    80288430
    8029 bool p2PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats, const char *recipe, psS32 p1_version, psS32 p2_version)
     8431bool p2PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version, psS32 p2_version)
    80308432{
    80318433    psMetadata      *md;
     
    80638465        return false;
    80648466    }
    8065     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) {
    8066         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     8467    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {
     8468        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     8469        psFree(md);
     8470        return false;
     8471    }
     8472    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) {
     8473        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     8474        psFree(md);
     8475        return false;
     8476    }
     8477    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) {
     8478        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     8479        psFree(md);
     8480        return false;
     8481    }
     8482    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) {
     8483        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     8484        psFree(md);
     8485        return false;
     8486    }
     8487    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) {
     8488        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    80678489        psFree(md);
    80688490        return false;
     
    80908512}
    80918513
    8092 bool p2PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **stats, char **recipe, psS32 *p1_version, psS32 *p2_version)
     8514bool p2PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time, char **recipe, psS32 *p1_version, psS32 *p2_version)
    80938515{
    80948516    psArray         *rowSet;
     
    81708592        return false;
    81718593    }
    8172     *stats = psMetadataLookupPtr(&status, row, "stats");
    8173     if (!status) {
    8174         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     8594    *class = psMetadataLookupPtr(&status, row, "class");
     8595    if (!status) {
     8596        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     8597        psFree(row);
     8598        return false;
     8599    }
     8600    *airmass = psMetadataLookupF32(&status, row, "airmass");
     8601    if (!status) {
     8602        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     8603        psFree(row);
     8604        return false;
     8605    }
     8606    *ra = psMetadataLookupF32(&status, row, "ra");
     8607    if (!status) {
     8608        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     8609        psFree(row);
     8610        return false;
     8611    }
     8612    *dec = psMetadataLookupF32(&status, row, "dec");
     8613    if (!status) {
     8614        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     8615        psFree(row);
     8616        return false;
     8617    }
     8618    *exp_time = psMetadataLookupF32(&status, row, "exp_time");
     8619    if (!status) {
     8620        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    81758621        psFree(row);
    81768622        return false;
     
    82028648bool p2PendingExpInsertObject(psDB *dbh, p2PendingExpRow *object)
    82038649{
    8204     return p2PendingExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->stats, object->recipe, object->p1_version, object->p2_version);
     8650    return p2PendingExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time, object->recipe, object->p1_version, object->p2_version);
    82058651}
    82068652
     
    82138659    psS32           imfiles;
    82148660    char            filter[256];
    8215     char            stats[256];
     8661    char            class[256];
     8662    psF32           airmass;
     8663    psF32           ra;
     8664    psF32           dec;
     8665    psF32           exp_time;
    82168666    char            recipe[256];
    82178667    psS32           p1_version;
    82188668    psS32           p2_version;
    82198669
    8220     if (!p2PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats, (char **)&recipe, &p1_version, &p2_version)) {
     8670    if (!p2PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time, (char **)&recipe, &p1_version, &p2_version)) {
    82218671        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    82228672        return NULL;
    82238673    }
    82248674
    8225     return p2PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version, p2_version);
     8675    return p2PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version, p2_version);
    82268676}
    82278677
     
    83528802        return NULL;
    83538803    }
    8354     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) {
    8355         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     8804    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {
     8805        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     8806        psFree(md);
     8807        return NULL;
     8808    }
     8809    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) {
     8810        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     8811        psFree(md);
     8812        return NULL;
     8813    }
     8814    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) {
     8815        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     8816        psFree(md);
     8817        return NULL;
     8818    }
     8819    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) {
     8820        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     8821        psFree(md);
     8822        return NULL;
     8823    }
     8824    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) {
     8825        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    83568826        psFree(md);
    83578827        return NULL;
     
    83858855    psS32           imfiles;
    83868856    char            *filter;
    8387     char            *stats;
     8857    char            *class;
     8858    psF32           airmass;
     8859    psF32           ra;
     8860    psF32           dec;
     8861    psF32           exp_time;
    83888862    char            *recipe;
    83898863    psS32           p1_version;
     
    84208894        return false;
    84218895    }
    8422     stats = psMetadataLookupPtr(&status, md, "stats");
    8423     if (!status) {
    8424         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     8896    class = psMetadataLookupPtr(&status, md, "class");
     8897    if (!status) {
     8898        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     8899        return false;
     8900    }
     8901    airmass = psMetadataLookupF32(&status, md, "airmass");
     8902    if (!status) {
     8903        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     8904        return false;
     8905    }
     8906    ra = psMetadataLookupF32(&status, md, "ra");
     8907    if (!status) {
     8908        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     8909        return false;
     8910    }
     8911    dec = psMetadataLookupF32(&status, md, "dec");
     8912    if (!status) {
     8913        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     8914        return false;
     8915    }
     8916    exp_time = psMetadataLookupF32(&status, md, "exp_time");
     8917    if (!status) {
     8918        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    84258919        return false;
    84268920    }
     
    84418935    }
    84428936
    8443     return p2PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version, p2_version);
     8937    return p2PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version, p2_version);
    84448938}
    84458939psArray *p2PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    89889482static void p2DoneExpRowFree(p2DoneExpRow *object);
    89899483
    8990 p2DoneExpRow *p2DoneExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats, const char *recipe, psS32 p1_version, psS32 p2_version)
     9484p2DoneExpRow *p2DoneExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version, psS32 p2_version)
    89919485{
    89929486    p2DoneExpRow    *object;
     
    90019495    object->imfiles = imfiles;
    90029496    object->filter = psStringCopy(filter);
    9003     object->stats = psStringCopy(stats);
     9497    object->class = psStringCopy(class);
     9498    object->airmass = airmass;
     9499    object->ra = ra;
     9500    object->dec = dec;
     9501    object->exp_time = exp_time;
    90049502    object->recipe = psStringCopy(recipe);
    90059503    object->p1_version = p1_version;
     
    90169514    psFree(object->exp_type);
    90179515    psFree(object->filter);
    9018     psFree(object->stats);
     9516    psFree(object->class);
    90199517    psFree(object->recipe);
    90209518}
     
    90619559        return false;
    90629560    }
    9063     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) {
    9064         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     9561    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) {
     9562        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     9563        psFree(md);
     9564        return false;
     9565    }
     9566    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) {
     9567        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     9568        psFree(md);
     9569        return false;
     9570    }
     9571    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) {
     9572        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     9573        psFree(md);
     9574        return false;
     9575    }
     9576    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) {
     9577        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     9578        psFree(md);
     9579        return false;
     9580    }
     9581    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) {
     9582        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    90659583        psFree(md);
    90669584        return false;
     
    90949612}
    90959613
    9096 bool p2DoneExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats, const char *recipe, psS32 p1_version, psS32 p2_version)
     9614bool p2DoneExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version, psS32 p2_version)
    90979615{
    90989616    psMetadata      *md;
     
    91309648        return false;
    91319649    }
    9132     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) {
    9133         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     9650    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {
     9651        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     9652        psFree(md);
     9653        return false;
     9654    }
     9655    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) {
     9656        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     9657        psFree(md);
     9658        return false;
     9659    }
     9660    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) {
     9661        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     9662        psFree(md);
     9663        return false;
     9664    }
     9665    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) {
     9666        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     9667        psFree(md);
     9668        return false;
     9669    }
     9670    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) {
     9671        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    91349672        psFree(md);
    91359673        return false;
     
    91579695}
    91589696
    9159 bool p2DoneExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **stats, char **recipe, psS32 *p1_version, psS32 *p2_version)
     9697bool p2DoneExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time, char **recipe, psS32 *p1_version, psS32 *p2_version)
    91609698{
    91619699    psArray         *rowSet;
     
    92379775        return false;
    92389776    }
    9239     *stats = psMetadataLookupPtr(&status, row, "stats");
    9240     if (!status) {
    9241         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     9777    *class = psMetadataLookupPtr(&status, row, "class");
     9778    if (!status) {
     9779        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     9780        psFree(row);
     9781        return false;
     9782    }
     9783    *airmass = psMetadataLookupF32(&status, row, "airmass");
     9784    if (!status) {
     9785        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     9786        psFree(row);
     9787        return false;
     9788    }
     9789    *ra = psMetadataLookupF32(&status, row, "ra");
     9790    if (!status) {
     9791        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     9792        psFree(row);
     9793        return false;
     9794    }
     9795    *dec = psMetadataLookupF32(&status, row, "dec");
     9796    if (!status) {
     9797        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     9798        psFree(row);
     9799        return false;
     9800    }
     9801    *exp_time = psMetadataLookupF32(&status, row, "exp_time");
     9802    if (!status) {
     9803        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    92429804        psFree(row);
    92439805        return false;
     
    92699831bool p2DoneExpInsertObject(psDB *dbh, p2DoneExpRow *object)
    92709832{
    9271     return p2DoneExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->stats, object->recipe, object->p1_version, object->p2_version);
     9833    return p2DoneExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time, object->recipe, object->p1_version, object->p2_version);
    92729834}
    92739835
     
    92809842    psS32           imfiles;
    92819843    char            filter[256];
    9282     char            stats[256];
     9844    char            class[256];
     9845    psF32           airmass;
     9846    psF32           ra;
     9847    psF32           dec;
     9848    psF32           exp_time;
    92839849    char            recipe[256];
    92849850    psS32           p1_version;
    92859851    psS32           p2_version;
    92869852
    9287     if (!p2DoneExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats, (char **)&recipe, &p1_version, &p2_version)) {
     9853    if (!p2DoneExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time, (char **)&recipe, &p1_version, &p2_version)) {
    92889854        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    92899855        return NULL;
    92909856    }
    92919857
    9292     return p2DoneExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version, p2_version);
     9858    return p2DoneExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version, p2_version);
    92939859}
    92949860
     
    94199985        return NULL;
    94209986    }
    9421     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) {
    9422         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     9987    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {
     9988        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     9989        psFree(md);
     9990        return NULL;
     9991    }
     9992    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) {
     9993        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     9994        psFree(md);
     9995        return NULL;
     9996    }
     9997    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) {
     9998        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     9999        psFree(md);
     10000        return NULL;
     10001    }
     10002    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) {
     10003        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     10004        psFree(md);
     10005        return NULL;
     10006    }
     10007    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) {
     10008        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    942310009        psFree(md);
    942410010        return NULL;
     
    945210038    psS32           imfiles;
    945310039    char            *filter;
    9454     char            *stats;
     10040    char            *class;
     10041    psF32           airmass;
     10042    psF32           ra;
     10043    psF32           dec;
     10044    psF32           exp_time;
    945510045    char            *recipe;
    945610046    psS32           p1_version;
     
    948710077        return false;
    948810078    }
    9489     stats = psMetadataLookupPtr(&status, md, "stats");
    9490     if (!status) {
    9491         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     10079    class = psMetadataLookupPtr(&status, md, "class");
     10080    if (!status) {
     10081        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     10082        return false;
     10083    }
     10084    airmass = psMetadataLookupF32(&status, md, "airmass");
     10085    if (!status) {
     10086        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     10087        return false;
     10088    }
     10089    ra = psMetadataLookupF32(&status, md, "ra");
     10090    if (!status) {
     10091        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     10092        return false;
     10093    }
     10094    dec = psMetadataLookupF32(&status, md, "dec");
     10095    if (!status) {
     10096        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     10097        return false;
     10098    }
     10099    exp_time = psMetadataLookupF32(&status, md, "exp_time");
     10100    if (!status) {
     10101        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    949210102        return false;
    949310103    }
     
    950810118    }
    950910119
    9510     return p2DoneExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version, p2_version);
     10120    return p2DoneExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version, p2_version);
    951110121}
    951210122psArray *p2DoneExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    1005510665static void p3PendingExpRowFree(p3PendingExpRow *object);
    1005610666
    10057 p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_id, const char *camera, const char *exp_type, psS32 imfiles, const char *filter, const char *stats, const char *recipe, psS32 p2_version, psS32 p3_version)
     10667p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_id, const char *camera, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p2_version, psS32 p3_version)
    1005810668{
    1005910669    p3PendingExpRow *object;
     
    1006710677    object->imfiles = imfiles;
    1006810678    object->filter = psStringCopy(filter);
    10069     object->stats = psStringCopy(stats);
     10679    object->class = psStringCopy(class);
     10680    object->airmass = airmass;
     10681    object->ra = ra;
     10682    object->dec = dec;
     10683    object->exp_time = exp_time;
    1007010684    object->recipe = psStringCopy(recipe);
    1007110685    object->p2_version = p2_version;
     
    1008110695    psFree(object->exp_type);
    1008210696    psFree(object->filter);
    10083     psFree(object->stats);
     10697    psFree(object->class);
    1008410698    psFree(object->recipe);
    1008510699}
     
    1012110735        return false;
    1012210736    }
    10123     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) {
    10124         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     10737    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) {
     10738        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     10739        psFree(md);
     10740        return false;
     10741    }
     10742    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) {
     10743        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     10744        psFree(md);
     10745        return false;
     10746    }
     10747    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) {
     10748        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     10749        psFree(md);
     10750        return false;
     10751    }
     10752    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) {
     10753        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     10754        psFree(md);
     10755        return false;
     10756    }
     10757    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) {
     10758        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    1012510759        psFree(md);
    1012610760        return false;
     
    1015410788}
    1015510789
    10156 bool p3PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *exp_type, psS32 imfiles, const char *filter, const char *stats, const char *recipe, psS32 p2_version, psS32 p3_version)
     10790bool p3PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p2_version, psS32 p3_version)
    1015710791{
    1015810792    psMetadata      *md;
     
    1018510819        return false;
    1018610820    }
    10187     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) {
    10188         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     10821    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {
     10822        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     10823        psFree(md);
     10824        return false;
     10825    }
     10826    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) {
     10827        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     10828        psFree(md);
     10829        return false;
     10830    }
     10831    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) {
     10832        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     10833        psFree(md);
     10834        return false;
     10835    }
     10836    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) {
     10837        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     10838        psFree(md);
     10839        return false;
     10840    }
     10841    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) {
     10842        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    1018910843        psFree(md);
    1019010844        return false;
     
    1021210866}
    1021310867
    10214 bool p3PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **exp_type, psS32 *imfiles, char **filter, char **stats, char **recipe, psS32 *p2_version, psS32 *p3_version)
     10868bool p3PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time, char **recipe, psS32 *p2_version, psS32 *p3_version)
    1021510869{
    1021610870    psArray         *rowSet;
     
    1028610940        return false;
    1028710941    }
    10288     *stats = psMetadataLookupPtr(&status, row, "stats");
    10289     if (!status) {
    10290         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     10942    *class = psMetadataLookupPtr(&status, row, "class");
     10943    if (!status) {
     10944        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     10945        psFree(row);
     10946        return false;
     10947    }
     10948    *airmass = psMetadataLookupF32(&status, row, "airmass");
     10949    if (!status) {
     10950        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     10951        psFree(row);
     10952        return false;
     10953    }
     10954    *ra = psMetadataLookupF32(&status, row, "ra");
     10955    if (!status) {
     10956        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     10957        psFree(row);
     10958        return false;
     10959    }
     10960    *dec = psMetadataLookupF32(&status, row, "dec");
     10961    if (!status) {
     10962        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     10963        psFree(row);
     10964        return false;
     10965    }
     10966    *exp_time = psMetadataLookupF32(&status, row, "exp_time");
     10967    if (!status) {
     10968        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    1029110969        psFree(row);
    1029210970        return false;
     
    1031810996bool p3PendingExpInsertObject(psDB *dbh, p3PendingExpRow *object)
    1031910997{
    10320     return p3PendingExpInsert(dbh, object->exp_id, object->camera, object->exp_type, object->imfiles, object->filter, object->stats, object->recipe, object->p2_version, object->p3_version);
     10998    return p3PendingExpInsert(dbh, object->exp_id, object->camera, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time, object->recipe, object->p2_version, object->p3_version);
    1032110999}
    1032211000
     
    1032811006    psS32           imfiles;
    1032911007    char            filter[256];
    10330     char            stats[256];
     11008    char            class[256];
     11009    psF32           airmass;
     11010    psF32           ra;
     11011    psF32           dec;
     11012    psF32           exp_time;
    1033111013    char            recipe[256];
    1033211014    psS32           p2_version;
    1033311015    psS32           p3_version;
    1033411016
    10335     if (!p3PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats, (char **)&recipe, &p2_version, &p3_version)) {
     11017    if (!p3PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time, (char **)&recipe, &p2_version, &p3_version)) {
    1033611018        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    1033711019        return NULL;
    1033811020    }
    1033911021
    10340     return p3PendingExpRowAlloc(exp_id, camera, exp_type, imfiles, filter, stats, recipe, p2_version, p3_version);
     11022    return p3PendingExpRowAlloc(exp_id, camera, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p2_version, p3_version);
    1034111023}
    1034211024
     
    1046211144        return NULL;
    1046311145    }
    10464     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) {
    10465         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     11146    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {
     11147        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     11148        psFree(md);
     11149        return NULL;
     11150    }
     11151    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) {
     11152        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     11153        psFree(md);
     11154        return NULL;
     11155    }
     11156    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) {
     11157        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     11158        psFree(md);
     11159        return NULL;
     11160    }
     11161    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) {
     11162        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     11163        psFree(md);
     11164        return NULL;
     11165    }
     11166    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) {
     11167        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    1046611168        psFree(md);
    1046711169        return NULL;
     
    1049411196    psS32           imfiles;
    1049511197    char            *filter;
    10496     char            *stats;
     11198    char            *class;
     11199    psF32           airmass;
     11200    psF32           ra;
     11201    psF32           dec;
     11202    psF32           exp_time;
    1049711203    char            *recipe;
    1049811204    psS32           p2_version;
     
    1052411230        return false;
    1052511231    }
    10526     stats = psMetadataLookupPtr(&status, md, "stats");
    10527     if (!status) {
    10528         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     11232    class = psMetadataLookupPtr(&status, md, "class");
     11233    if (!status) {
     11234        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     11235        return false;
     11236    }
     11237    airmass = psMetadataLookupF32(&status, md, "airmass");
     11238    if (!status) {
     11239        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     11240        return false;
     11241    }
     11242    ra = psMetadataLookupF32(&status, md, "ra");
     11243    if (!status) {
     11244        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     11245        return false;
     11246    }
     11247    dec = psMetadataLookupF32(&status, md, "dec");
     11248    if (!status) {
     11249        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     11250        return false;
     11251    }
     11252    exp_time = psMetadataLookupF32(&status, md, "exp_time");
     11253    if (!status) {
     11254        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    1052911255        return false;
    1053011256    }
     
    1054511271    }
    1054611272
    10547     return p3PendingExpRowAlloc(exp_id, camera, exp_type, imfiles, filter, stats, recipe, p2_version, p3_version);
     11273    return p3PendingExpRowAlloc(exp_id, camera, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p2_version, p3_version);
    1054811274}
    1054911275psArray *p3PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    1094311669static void detInputExpRowFree(detInputExpRow *object);
    1094411670
    10945 detInputExpRow *detInputExpRowAlloc(psS32 det_id, psS32 iteration, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats)
     11671detInputExpRow *detInputExpRowAlloc(psS32 det_id, psS32 iteration, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time)
    1094611672{
    1094711673    detInputExpRow  *object;
     
    1095811684    object->imfiles = imfiles;
    1095911685    object->filter = psStringCopy(filter);
    10960     object->stats = psStringCopy(stats);
     11686    object->class = psStringCopy(class);
     11687    object->airmass = airmass;
     11688    object->ra = ra;
     11689    object->dec = dec;
     11690    object->exp_time = exp_time;
    1096111691
    1096211692    return object;
     
    1097011700    psFree(object->exp_type);
    1097111701    psFree(object->filter);
    10972     psFree(object->stats);
     11702    psFree(object->class);
    1097311703}
    1097411704
     
    1102411754        return false;
    1102511755    }
    11026     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) {
    11027         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     11756    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) {
     11757        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     11758        psFree(md);
     11759        return false;
     11760    }
     11761    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) {
     11762        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     11763        psFree(md);
     11764        return false;
     11765    }
     11766    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) {
     11767        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     11768        psFree(md);
     11769        return false;
     11770    }
     11771    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) {
     11772        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     11773        psFree(md);
     11774        return false;
     11775    }
     11776    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) {
     11777        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    1102811778        psFree(md);
    1102911779        return false;
     
    1104211792}
    1104311793
    11044 bool detInputExpInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *stats)
     11794bool detInputExpInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time)
    1104511795{
    1104611796    psMetadata      *md;
     
    1108811838        return false;
    1108911839    }
    11090     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) {
    11091         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     11840    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {
     11841        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     11842        psFree(md);
     11843        return false;
     11844    }
     11845    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) {
     11846        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     11847        psFree(md);
     11848        return false;
     11849    }
     11850    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) {
     11851        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     11852        psFree(md);
     11853        return false;
     11854    }
     11855    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) {
     11856        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     11857        psFree(md);
     11858        return false;
     11859    }
     11860    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) {
     11861        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    1109211862        psFree(md);
    1109311863        return false;
     
    1110011870}
    1110111871
    11102 bool detInputExpPop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **stats)
     11872bool detInputExpPop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time)
    1110311873{
    1110411874    psArray         *rowSet;
     
    1119211962        return false;
    1119311963    }
    11194     *stats = psMetadataLookupPtr(&status, row, "stats");
    11195     if (!status) {
    11196         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
     11964    *class = psMetadataLookupPtr(&status, row, "class");
     11965    if (!status) {
     11966        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     11967        psFree(row);
     11968        return false;
     11969    }
     11970    *airmass = psMetadataLookupF32(&status, row, "airmass");
     11971    if (!status) {
     11972        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     11973        psFree(row);
     11974        return false;
     11975    }
     11976    *ra = psMetadataLookupF32(&status, row, "ra");
     11977    if (!status) {
     11978        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     11979        psFree(row);
     11980        return false;
     11981    }
     11982    *dec = psMetadataLookupF32(&status, row, "dec");
     11983    if (!status) {
     11984        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     11985        psFree(row);
     11986        return false;
     11987    }
     11988    *exp_time = psMetadataLookupF32(&status, row, "exp_time");
     11989    if (!status) {
     11990        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
    1119711991        psFree(row);
    1119811992        return false;
     
    1120612000bool detInputExpInsertObject(psDB *dbh, detInputExpRow *object)
    1120712001{
    11208     return detInputExpInsert(dbh, object->det_id, object->iteration, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->stats);
     12002    return detInputExpInsert(dbh, object->det_id, object->iteration, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time);
    1120912003}
    1121012004
     
    1121912013    psS32           imfiles;
    1122012014    char            filter[256];
    11221     char            stats[256];
    11222 
    11223     if (!detInputExpPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats)) {
     12015    char            class[256];
     12016    psF32           airmass;
     12017    psF32           ra;
     12018    psF32           dec;
     12019    psF32           exp_time;
     12020
     12021    if (!detInputExpPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time)) {
    1122412022        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    1122512023        return NULL;
    1122612024    }
    1122712025
    11228     return detInputExpRowAlloc(det_id, iteration, exp_id, camera, telescope, exp_type, imfiles, filter, stats);
     12026    return detInputExpRowAlloc(det_id, iteration, exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time);
    1122912027}
    1123012028
     
    1136512163        return NULL;
    1136612164    }
    11367     if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) {
    11368         psError(PS_ERR_UNKNOWN, false, "failed to add item stats");
     12165    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {
     12166        psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     12167        psFree(md);
     12168        return NULL;
     12169    }
     12170    if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) {
     12171        psError(PS_ERR_UNKNOWN, false, "failed to add item airmass");
     12172        psFree(md);
     12173        return NULL;
     12174    }
     12175    if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) {
     12176        psError(PS_ERR_UNKNOWN, false, "failed to add item ra");
     12177        psFree(md);
     12178        return NULL;
     12179    }
     12180    if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) {
     12181        psError(PS_ERR_UNKNOWN, false, "failed to add item dec");
     12182        psFree(md);
     12183        return NULL;
     12184    }
     12185    if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) {
     12186        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time");
    1136912187        psFree(md);
    1137012188        return NULL;
     
    1138512203    psS32           imfiles;
    1138612204    char            *filter;
    11387     char            *stats;
     12205    char            *class;
     12206    psF32           airmass;
     12207    psF32           ra;
     12208    psF32           dec;
     12209    psF32           exp_time;
    1138812210
    1138912211    det_id = psMetadataLookupS32(&status, md, "det_id");
     
    1142712249        return false;
    1142812250    }
    11429     stats = psMetadataLookupPtr(&status, md, "stats");
    11430     if (!status) {
    11431         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats");
    11432         return false;
    11433     }
    11434 
    11435     return detInputExpRowAlloc(det_id, iteration, exp_id, camera, telescope, exp_type, imfiles, filter, stats);
     12251    class = psMetadataLookupPtr(&status, md, "class");
     12252    if (!status) {
     12253        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
     12254        return false;
     12255    }
     12256    airmass = psMetadataLookupF32(&status, md, "airmass");
     12257    if (!status) {
     12258        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass");
     12259        return false;
     12260    }
     12261    ra = psMetadataLookupF32(&status, md, "ra");
     12262    if (!status) {
     12263        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra");
     12264        return false;
     12265    }
     12266    dec = psMetadataLookupF32(&status, md, "dec");
     12267    if (!status) {
     12268        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec");
     12269        return false;
     12270    }
     12271    exp_time = psMetadataLookupF32(&status, md, "exp_time");
     12272    if (!status) {
     12273        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time");
     12274        return false;
     12275    }
     12276
     12277    return detInputExpRowAlloc(det_id, iteration, exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time);
    1143612278}
    1143712279psArray *detInputExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note: See TracChangeset for help on using the changeset viewer.