IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 28, 2008, 1:11:24 PM (18 years ago)
Author:
jhoblitt
Message:

add warptool -updaterun query support

File:
1 edited

Legend:

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

    r17145 r17180  
    175175    PS_ASSERT_PTR_NON_NULL(config, false);
    176176
    177     PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false);
    178     PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);
     177    PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", false, false);
     178    PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", false, false);
     179    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
     180    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
     181
     182    psMetadata *where = psMetadataAlloc();
     183    // convert warp_id into a psS64
     184    if (warp_id) {
     185        if (!psMetadataAddS64(where, PS_LIST_TAIL, "warp_id", 0, "==", (psS64)atoll(warp_id))) {
     186            psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
     187            psFree(where);
     188            return false;
     189        }
     190    }
     191
     192    // convert cam_id into a psS64
     193    if (cam_id) {
     194        if (!psMetadataAddS64(where, PS_LIST_TAIL, "cam_id", 0, "==", (psS64)atoll(cam_id))) {
     195            psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
     196            psFree(where);
     197            return false;
     198        }
     199    }
     200
     201    // convert chip_id into a psS64
     202    if (chip_id) {
     203        if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
     204            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
     205            psFree(where);
     206            return false;
     207        }
     208    }
     209
     210    // convert exp_id into a psS64
     211    if (exp_id) {
     212        if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
     213            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     214            psFree(where);
     215            return false;
     216        }
     217    }
     218
     219    PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
     220    PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
     221    PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "==");
     222    PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs", ">=");
     223    PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "dateobs", "<=");
     224    PXOPT_COPY_STR(config->args, where, "-exp_tag", "exp_tag", "==");
     225    PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "==");
     226    PXOPT_COPY_STR(config->args, where, "-filelevel", "filelevel", "==");
     227    PXOPT_COPY_STR(config->args, where, "-reduction", "reduction", "==");
     228    PXOPT_COPY_STR(config->args, where, "-filter", "filter", "==");
     229
     230    PXOPT_COPY_F64(config->args, where, "-airmass_min", "airmass", ">=");
     231    PXOPT_COPY_F64(config->args, where, "-airmass_max", "airmass", "<");
     232    PXOPT_COPY_F64(config->args, where, "-ra_min", "ra", ">=");
     233    PXOPT_COPY_F64(config->args, where, "-ra_max", "ra", "<");
     234    PXOPT_COPY_F64(config->args, where, "-decl_min", "decl", ">=");
     235    PXOPT_COPY_F64(config->args, where, "-decl_max", "decl", "<");
     236    PXOPT_COPY_F32(config->args, where, "-exp_time_min", "exp_time", ">=");
     237    PXOPT_COPY_F32(config->args, where, "-exp_time_max", "exp_time", "<");
     238    PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_min", "sat_pixel_frac", ">=");
     239    PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_max", "sat_pixel_frac", "<");
     240    PXOPT_COPY_F64(config->args, where, "-bg_min", "bt", ">=");
     241    PXOPT_COPY_F64(config->args, where, "-bg_max", "bt", "<");
     242    PXOPT_COPY_F64(config->args, where, "-bg_stdev_min", "bg_stdev", ">=");
     243    PXOPT_COPY_F64(config->args, where, "-bg_stdev_max", "bg_stdev", "<");
     244    PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_min", "bg_mean_stdev", ">=");
     245    PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_max", "bg_mean_stdev", "<");
     246    PXOPT_COPY_F64(config->args, where, "-alt_min", "alt", ">=");
     247    PXOPT_COPY_F64(config->args, where, "-alt_max", "alt", "<");
     248    PXOPT_COPY_F64(config->args, where, "-az_min", "az", ">=");
     249    PXOPT_COPY_F64(config->args, where, "-az_max", "az", "<");
     250    PXOPT_COPY_F32(config->args, where, "-ccd_temp_min", "ccd_temp", ">=");
     251    PXOPT_COPY_F32(config->args, where, "-ccd_temp_max", "ccd_temp", "<");
     252    PXOPT_COPY_F64(config->args, where, "-posang_min", "posang", ">=");
     253    PXOPT_COPY_F64(config->args, where, "-posang_max", "posang", "<");
     254    PXOPT_COPY_STR(config->args, where, "-object", "object", "==");
     255    PXOPT_COPY_F32(config->args, where, "-solang_min", "solang", ">=");
     256    PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<");
     257
     258    if (!psListLength(where->list)) {
     259        psFree(where);
     260        psError(PXTOOLS_ERR_DATA, false, "search parameters are required");
     261        return false;
     262    }
     263
     264    PXOPT_LOOKUP_STR(state, config->args, "-state", false, false);
     265    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
     266
     267    if ((!state) && (!label)) {
     268        psError(PXTOOLS_ERR_DATA, false, "parameters are required");
     269        return false;
     270    }
    179271
    180272    if (state) {
    181         // set detRun.state to state
    182         return pxwarpRunSetState(config, (psS64)atoll(warp_id), state);
     273        // set chipRun.state to state
     274        if (!pxwarpRunSetStateByQuery(config, where, state)) {
     275            return false;
     276        }
     277    }
     278
     279    if (label) {
     280        // set chipRun.label to label
     281        if (!pxwarpRunSetLabelByQuery(config, where, label)) {
     282            return false;
     283        }
    183284    }
    184285
Note: See TracChangeset for help on using the changeset viewer.