IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8383


Ignore:
Timestamp:
Aug 15, 2006, 6:42:32 PM (20 years ago)
Author:
jhoblitt
Message:

implement -toresid

File:
1 edited

Legend:

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

    r8379 r8383  
    21932193static bool toresidMode(pxConfig *config)
    21942194{
     2195    PS_ASSERT_PTR_NON_NULL(config, false);
     2196
     2197    /*
     2198which returns a list of processed imfiles (with corresponding detrend
     2199id, iteration, class id, uri, type) for which the appropriate stacked
     2200imfile has been normalised, and which have not been masked out by
     2201detResidImfileAnalysis; it also returns stackedImfiles that have
     2202"-pleasenormalize" set to false.
     2203*/
     2204
     2205    // select detNormalizedStatImfile.*
     2206    // by:
     2207    // where det_id, iteration, class_id is not in detNormalizedImfile
     2208
     2209    psString query = psStringCopy(
     2210        "SELECT"
     2211        "   detRun.iteration as iteration,"
     2212        "   detProcessedImfile.*"
     2213        " FROM detRun"
     2214        " LEFT JOIN detInputExp"
     2215        "   ON detRun.position = detInputExp.det_id"
     2216        "   AND detRun.iteration = detInputExp.iteration"
     2217        " LEFT JOIN detProcessedImfile"
     2218        "   ON detRun.position = detProcessedImfile.det_id"
     2219        "   AND detInputExp.exp_id = detProcessedImfile.exp_id"
     2220        " LEFT JOIN detNormalizedImfile"
     2221        "   ON detRun.position = detNormalizedImfile.det_id"
     2222        "   AND detRun.iteration = detNormalizedImfile.iteration"
     2223        "   AND detProcessedImfile.class_id = detNormalizedImfile.class_id"
     2224        " LEFT JOIN detResidImfile"
     2225        "   ON detRun.position = detResidImfile.det_id"
     2226        "   AND detRun.iteration = detResidImfile.iteration"
     2227        "   AND detProcessedImfile.class_id = detResidImfile.class_id"
     2228        " WHERE"
     2229        "   detResidImfile.det_id IS NULL" 
     2230        "   AND detResidImfile.iteration IS NULL" 
     2231        "   AnD detResidImfile.class_id IS NULL" 
     2232        );
     2233
     2234    // XXX does it make sens to accept any search params?
     2235#if 0
     2236    if (config->where) {
     2237        psString whereClaus = psDBGenerateWhereConditionSQL(config->where);
     2238        psStringAppend(&query, " AND %s", whereClaus);
     2239        psFree(whereClaus);
     2240    }
     2241#endif
     2242
     2243    if (!p_psDBRunQuery(config->dbh, query)) {
     2244        psError(PS_ERR_UNKNOWN, false, "database error");
     2245        psFree(query);
     2246        return false;
     2247    }
     2248    psFree(query);
     2249
     2250    psArray *output = p_psDBFetchResult(config->dbh);
     2251    if (!output) {
     2252        // XXX check psError here
     2253        psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
     2254        return false;
     2255    }
     2256
     2257    bool simple = false;
     2258    {
     2259        bool status = false;
     2260        simple = psMetadataLookupBool(&status, config->args, "-simple");
     2261        if (!status) {
     2262            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     2263            psFree(output);
     2264            return false;
     2265        }
     2266    }
     2267
     2268    // negative simple so the default is true
     2269    if (!ippdbPrintMetadatas(stdout, output, "rawDetrendImfile", !simple)) {
     2270        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     2271        psFree(output);
     2272        return false;
     2273    }
     2274
     2275    psFree(output);
     2276
    21952277    return true;
    21962278}
Note: See TracChangeset for help on using the changeset viewer.