IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 22, 2011, 10:25:28 AM (15 years ago)
Author:
bills
Message:

implement vptool -processedcellmode

File:
1 edited

Legend:

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

    r32511 r32750  
    282282    psFree(where);
    283283
    284     psStringAppend(&query, "\nGROUP BY vp_id HAVING");
    285284    psStringAppend(&query, "\nORDER BY priority DESC, vp_id");
    286285
     
    597596static bool processedcellMode(pxConfig *config)
    598597{
    599 return false;
    600 #ifdef notyet
    601598    PS_ASSERT_PTR_NON_NULL(config, NULL);
    602599
    603600    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    604601    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    605     PXOPT_LOOKUP_BOOL(faulted, config->args, "-faulted", false);
    606     PXOPT_LOOKUP_BOOL(allfiles, config->args, "-allfiles", false);
    607     if (allfiles) {
    608         faulted = false;
    609     }
    610     PXOPT_LOOKUP_BOOL(pstamp_order, config->args, "-pstamp_order", false);
    611602
    612603    psMetadata *where = psMetadataAlloc();
    613604    pxchipGetSearchArgs (config, where); // chipRun, chipProcessedImfile, rawExp
    614     PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "==");
    615     PXOPT_COPY_S64(config->args, where, "-chip_imfile_id", "chipImfile.chip_imfile_id", "==");
    616     PXOPT_COPY_STR(config->args, where, "-class_id", "chipProcessedImfile.class_id", "==");
    617     PXOPT_COPY_STR(config->args, where, "-reduction", "chipRun.reduction", "==");
    618     pxAddLabelSearchArgs (config, where, "-label", "chipRun.label", "LIKE");
    619     pxAddLabelSearchArgs (config, where, "-data_group", "chipRun.data_group", "LIKE");
    620     PXOPT_COPY_S64(config->args, where, "-magicked", "chipProcessedImfile.magicked", "==");
    621 
    622     psString where2 = NULL;
    623     pxmagicAddWhere(config, &where2, "chipProcessedImfile");
    624     // add cuts on ra and decl if supplied
    625     if (!pxspaceAddWhere(config, &where2, "rawExp")) {
    626         psError(psErrorCodeLast(), false, "pxSpaceAddWhere failed");
    627         return false;
    628     }
     605    PXOPT_COPY_S64(config->args, where, "-vp_id", "vp_id", "==");
     606    PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "==");
     607    PXOPT_COPY_STR(config->args, where, "-cell_id", "cell_id", "==");
     608    pxAddLabelSearchArgs (config, where, "-label", "vpRun.label", "LIKE");
     609    pxAddLabelSearchArgs (config, where, "-data_group", "vpRun.data_group", "LIKE");
    629610
    630611    psString query = pxDataGet("vptool_processedcell.sql");
     
    636617    if (psListLength(where->list)) {
    637618        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    638         psStringAppend(&query, " WHERE %s %s", whereClause, where2 ? where2 : "");
     619        psStringAppend(&query, " WHERE %s", whereClause);
    639620        psFree(whereClause);
    640     } else if (psMetadataLookupBool(NULL, config->args, "-all") || (faulted || where2)) {
    641         psStringAppend(&query, " WHERE chipRun.chip_id IS NOT NULL %s", where2 ? where2 : "");
    642621    } else {
    643622        psFree(where);
    644         psError(PXTOOLS_ERR_CONFIG, false, "search parameters (or -all) are required");
     623        psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
    645624        return false;
    646625    }
    647626    psFree(where);
    648627
    649     if (faulted) {
    650         // list only faulted rows
    651         psStringAppend(&query, " %s", "AND chipProcessedImfile.fault != 0");
    652     } else if (!allfiles) {
    653         // don't list faulted rows
    654         psStringAppend(&query, " %s", "AND chipProcessedImfile.fault = 0");
    655     }
    656 
    657     if (pstamp_order) {
    658         // put runs in order of exposure id with newest chip Runs first
    659         // The postage stamp parser depends on this behavior
    660         psStringAppend(&query, "\nORDER by exp_id, chip_id DESC");
    661     }
    662 
    663     // treat limit == 0 as "no limit"
    664628    if (limit) {
    665629        psString limitString = psDBGenerateLimitSQL(limit);
     
    687651
    688652    // negative simple so the default is true
    689     if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) {
     653    if (!ippdbPrintMetadatas(stdout, output, "vpProcessedCell", !simple)) {
    690654        psError(PS_ERR_UNKNOWN, false, "failed to print array");
    691655        psFree(output);
     
    696660
    697661    return true;
    698 #endif
    699662}
    700663
Note: See TracChangeset for help on using the changeset viewer.