IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 1, 2013, 3:32:11 PM (13 years ago)
Author:
bills
Message:

changes to support relStack.stack_type 'nightly' fix some typos

File:
1 edited

Legend:

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

    r35437 r35460  
    856856    }
    857857
     858    psString joinConditions = psStringCopy("");
     859    // Finish up the selectors for the JOIN to previousRelStack
     860    // join to rows with our stack_type
     861    psStringAppend(&joinConditions, "\nAND previousRelStack.stack_type = '%s'", stack_type);
     862
     863    if (!strcmp(stack_type, "nightly")) {
     864        // detect nightly stack entries that already exist for this day
     865        psStringAppend(&joinConditions, "\nAND previousRelStack.mjd_obs = floor(stackSumSkyfile.mjd_obs)");
     866    }
     867
     868    // Add in the where conditions
    858869    psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    859     psStringAppend(&query, " AND %s", whereClause);
     870    psStringAppend(&query, "\nAND %s", whereClause);
    860871    psFree(whereClause);
     872
     873    if (!strcmp(stack_type, "nightly")) {
     874        // avoid stacks with NAN mjd_obs. These are old skycells that were lost due to system failure
     875        // prior to the time that the mjd_obs was extracted from the headers and added to stackSumSkyfile
     876        psStringAppend(&query, "\nAND stackSumSkyfile.mjd_obs IS NOT NULL");
     877    }
    861878
    862879    psFree(where);
     
    868885    }
    869886
    870     if (!p_psDBRunQuery(config->dbh, query)) {
     887    if (!p_psDBRunQueryF(config->dbh, query, joinConditions)) {
    871888        psError(PS_ERR_UNKNOWN, false, "database error");
    872889        psFree(query);
     890        psFree(joinConditions);
    873891        return false;
    874892    }
    875893    psFree(query);
     894    psFree(joinConditions);
    876895
    877896    psArray *output = p_psDBFetchResult(config->dbh);
     
    9931012    PXOPT_COPY_F32(config->args, where, "-mjd_min",    "stackSumSkyfile.mjd_obs", ">=");
    9941013    PXOPT_COPY_F32(config->args, where, "-mjd_max",    "stackSumSkyfile.mjd_obs", "<=");
    995     PXOPT_COPY_F32(config->args, where, "-fwhm_min",    "skycalResult.fwhm_minor", ">=");
    996     PXOPT_COPY_F32(config->args, where, "-fwhm_max",    "skycalresult.fwhm_major", "<=");
    9971014    PXOPT_COPY_STR(config->args, where, "-tess_id",     "relStack.tess_id", "==");
    9981015    PXOPT_COPY_STR(config->args, where, "-skycell_id",  "relStack.skycell_id", "LIKE");
     1016    PXOPT_COPY_STR(config->args, where, "-stack_type",  "relStack.stack_type", "==");
    9991017    PXOPT_COPY_STR(config->args, where, "-stack_data_group",  "stackRun.data_group", "LIKE");
    10001018    PXOPT_COPY_STR(config->args, where, "-skycal_data_group", "skycalRun.data_group", "LIKE");
     
    10031021    PXOPT_COPY_S32(config->args, where, "-rel_id",      "relExp.rel_id", "==");
    10041022    pxskycellAddWhere(config, where);
     1023
     1024    PXOPT_COPY_F32(config->args, where, "-fwhm_min",    "IFNULL(skycalResult.fwhm_major, 999)", ">=");
     1025    PXOPT_COPY_F32(config->args, where, "-fwhm_max",    "IFNULL(skycalResult.fwhm_major, 0)", "<=");
    10051026
    10061027    PXOPT_LOOKUP_BOOL(priority_order, config->args, "-priority_order", false);
     
    14951516    PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<=");
    14961517    PXOPT_COPY_F32(config->args, where, "-fwhm_min",    "skycalResult.fwhm_major", ">=");
    1497     PXOPT_COPY_F32(config->args, where, "-fwhm_max",    "skycalresult.fwhm_major", "<=");
     1518    PXOPT_COPY_F32(config->args, where, "-fwhm_max",    "skycalResult.fwhm_major", "<=");
    14981519    PXOPT_COPY_STR(config->args, where, "-exp_name",    "rawExp.exp_ame", "==");
    14991520    PXOPT_COPY_S64(config->args, where, "-exp_id",      "relExp.exp_id", "==");
Note: See TracChangeset for help on using the changeset viewer.