IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 20, 2006, 5:34:24 PM (20 years ago)
Author:
jhoblitt
Message:

add dettool -defineby* fpa attributes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/dettool.c

    r9539 r9707  
    220220        return false;
    221221    }
     222    psString exp_type = psMetadataLookupStr(&status, config->args, "-exp_type");
     223    if (!status) {
     224        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_type");
     225        return false;
     226    }
     227    if (!exp_type) {
     228        psError(PS_ERR_UNKNOWN, true, "-exp_type is required");
     229        return false;
     230    }
     231    psString filter = psMetadataLookupStr(&status, config->args, "-filter");
     232    if (!status) {
     233        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -filter");
     234        return false;
     235    }
     236    if (!filter) {
     237        psError(PS_ERR_UNKNOWN, true, "-filter is required");
     238        return false;
     239    }
     240    psF32 airmass = psMetadataLookupF32(&status, config->args, "-airmass");
     241    if (!status) {
     242        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -airmass");
     243        return false;
     244    }
     245    if (isnan(airmass)) {
     246        psError(PS_ERR_UNKNOWN, true, "-airmass is required");
     247        return false;
     248    }
     249    psF32 exp_time = psMetadataLookupF32(&status, config->args, "-exp_time");
     250    if (!status) {
     251        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_time");
     252        return false;
     253    }
     254    if (isnan(exp_time)) {
     255        psError(PS_ERR_UNKNOWN, true, "-exp_time is required");
     256        return false;
     257    }
     258    psF32 ccd_temp = psMetadataLookupF32(&status, config->args, "-ccd_temp");
     259    if (!status) {
     260        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ccd_temp");
     261        return false;
     262    }
     263    if (isnan(ccd_temp)) {
     264        psError(PS_ERR_UNKNOWN, true, "-ccd_temp is required");
     265        return false;
     266    }
     267    psF64 posang = psMetadataLookupF32(&status, config->args, "-posang");
     268    if (!status) {
     269        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -posang");
     270        return false;
     271    }
     272    if (isnan(posang)) {
     273        psError(PS_ERR_UNKNOWN, true, "-posang is required");
     274        return false;
     275    }
     276    // optional
     277    psString object = psMetadataLookupStr(&status, config->args, "-object");
     278    if (!status) {
     279        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -object");
     280        return false;
     281    }
     282    psTime *registered = NULL;
     283    {
     284        psString registeredStr = psMetadataLookupStr(&status, config->args, "-registered");
     285        if (!status) {
     286            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -registered");
     287            return false;
     288        }
     289        // pass through NULL as this is an optional field
     290        if (registeredStr) {
     291            registered = psTimeFromISO(registeredStr, PS_TIME_UTC);
     292        } else {
     293            registered = NULL;
     294        }
     295    }
     296   
     297    psTime *use_begin = NULL;
     298    {
     299        psString use_beginStr = psMetadataLookupStr(&status, config->args, "-use_begin");
     300        if (!status) {
     301            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -use_begin");
     302            return false;
     303        }
     304        // pass through NULL as this is an optional field
     305        if (use_beginStr) {
     306            use_begin = psTimeFromISO(use_beginStr, PS_TIME_UTC);
     307        } else {
     308            use_begin = NULL;
     309        }
     310    }
     311
     312    psTime *use_end = NULL;
     313    {
     314        psString use_endStr = psMetadataLookupStr(&status, config->args, "-use_end");
     315        if (!status) {
     316            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -use_end");
     317            return false;
     318        }
     319        // pass through NULL as this is an optional field
     320        if (use_endStr) {
     321            use_end = psTimeFromISO(use_endStr, PS_TIME_UTC);
     322        } else {
     323            use_end = NULL;
     324        }
     325    }
    222326
    223327    // we have to support multipe exp_tags
     
    290394    // XXX the camera name is set from the first inputExp
    291395    // XXX det_id
    292     detRunInsert(config->dbh, 0, 0, det_type, "run");
     396    detRunInsert(config->dbh,
     397            0,
     398            0,
     399            det_type,
     400            "run",
     401            exp_type,
     402            filter,
     403            airmass,
     404            exp_time,
     405            ccd_temp,
     406            posang,
     407            object,
     408            registered,
     409            use_begin,
     410            use_end
     411        );
    293412    long det_id = psDBLastInsertID(config->dbh);
    294413
     
    482601    }
    483602
     603    // there is some namespace overlap between the names of the fields we'd
     604    // like to search by to setup a detrun and the names of the fields we'd
     605    // like to assign values to so I've seperated them but prepending set- to
     606    // the assigned values
     607
     608    psString exp_type = psMetadataLookupStr(&status, config->args, "-set_exp_type");
     609    if (!status) {
     610        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_exp_type");
     611        return false;
     612    }
     613    if (!exp_type) {
     614        psError(PS_ERR_UNKNOWN, true, "-set_exp_type is required");
     615        return false;
     616    }
     617    psString filter = psMetadataLookupStr(&status, config->args, "-set_filter");
     618    if (!status) {
     619        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_filter");
     620        return false;
     621    }
     622    if (!filter) {
     623        psError(PS_ERR_UNKNOWN, true, "-set_filter is required");
     624        return false;
     625    }
     626    psF32 airmass = psMetadataLookupF32(&status, config->args, "-set_airmass");
     627    if (!status) {
     628        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_airmass");
     629        return false;
     630    }
     631    if (isnan(airmass)) {
     632        psError(PS_ERR_UNKNOWN, true, "-set_airmass is required");
     633        return false;
     634    }
     635    psF32 exp_time = psMetadataLookupF32(&status, config->args, "-set_exp_time");
     636    if (!status) {
     637        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_exp_time");
     638        return false;
     639    }
     640    if (isnan(exp_time)) {
     641        psError(PS_ERR_UNKNOWN, true, "-set_exp_time is required");
     642        return false;
     643    }
     644    psF32 ccd_temp = psMetadataLookupF32(&status, config->args, "-set_ccd_temp");
     645    if (!status) {
     646        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_ccd_temp");
     647        return false;
     648    }
     649    if (isnan(ccd_temp)) {
     650        psError(PS_ERR_UNKNOWN, true, "-set_ccd_temp is required");
     651        return false;
     652    }
     653    psF64 posang = psMetadataLookupF32(&status, config->args, "-set_posang");
     654    if (!status) {
     655        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_posang");
     656        return false;
     657    }
     658    if (isnan(posang)) {
     659        psError(PS_ERR_UNKNOWN, true, "-set_posang is required");
     660        return false;
     661    }
     662    // optional
     663    psString object = psMetadataLookupStr(&status, config->args, "-set_object");
     664    if (!status) {
     665        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_object");
     666        return false;
     667    }
     668    psTime *registered = NULL;
     669    {
     670        psString registeredStr = psMetadataLookupStr(&status, config->args, "-set_registered");
     671        if (!status) {
     672            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_registered");
     673            return false;
     674        }
     675        // pass through NULL as this is an optional field
     676        if (registeredStr) {
     677            registered = psTimeFromISO(registeredStr, PS_TIME_UTC);
     678        } else {
     679            registered = NULL;
     680        }
     681    }
     682   
     683    psTime *use_begin = NULL;
     684    {
     685        psString use_beginStr = psMetadataLookupStr(&status, config->args, "-set_use_begin");
     686        if (!status) {
     687            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_use_begin");
     688            return false;
     689        }
     690        // pass through NULL as this is an optional field
     691        if (use_beginStr) {
     692            use_begin = psTimeFromISO(use_beginStr, PS_TIME_UTC);
     693        } else {
     694            use_begin = NULL;
     695        }
     696    }
     697
     698    psTime *use_end = NULL;
     699    {
     700        psString use_endStr = psMetadataLookupStr(&status, config->args, "-set_use_end");
     701        if (!status) {
     702            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_use_end");
     703            return false;
     704        }
     705        // pass through NULL as this is an optional field
     706        if (use_endStr) {
     707            use_end = psTimeFromISO(use_endStr, PS_TIME_UTC);
     708        } else {
     709            use_end = NULL;
     710        }
     711    }
     712
    484713    // search for rawDetrendExps with the specified options
    485714    psArray *detrendExps = rawDetrendExpSelectRowObjects(config->dbh, where, 0);
     
    500729    // the first iteration is always 0
    501730    // XXX det_id
    502     detRunInsert(config->dbh, 0, 0, det_type, "run");
     731    detRunInsert(config->dbh,
     732            0,
     733            0,
     734            det_type,
     735            "run",
     736            exp_type,
     737            filter,
     738            airmass,
     739            exp_time,
     740            ccd_temp,
     741            posang,
     742            object,
     743            registered,
     744            use_begin,
     745            use_end
     746        );
    503747    long det_id = psDBLastInsertID(config->dbh);
    504748
Note: See TracChangeset for help on using the changeset viewer.