Changeset 18561 for trunk/ippTools/src/flatcorr.c
- Timestamp:
- Jul 15, 2008, 10:30:59 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/flatcorr.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/flatcorr.c
r18336 r18561 92 92 PS_ASSERT_PTR_NON_NULL(config, false); 93 93 94 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);95 96 94 psMetadata *where = psMetadataAlloc(); 97 // convert exp_id into a psS64 98 if (exp_id) { 99 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) { 100 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 101 psFree(where); 102 return false; 103 } 104 } 105 95 96 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 106 97 PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "=="); 107 98 PXOPT_COPY_STR(config->args, where, "-inst", "camera", "=="); … … 110 101 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "dateobs", "<="); 111 102 PXOPT_COPY_STR(config->args, where, "-exp_tag", "exp_tag", "=="); 103 PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "=="); 112 104 PXOPT_COPY_STR(config->args, where, "-filelevel", "filelvel", "=="); 113 105 PXOPT_COPY_STR(config->args, where, "-reduction", "reduction", "=="); 114 106 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 115 PXOPT_COPY_F 64(config->args, where, "-airmass_min", "airmass", ">=");116 PXOPT_COPY_F 64(config->args, where, "-airmass_max", "airmass", "<");107 PXOPT_COPY_F32(config->args, where, "-airmass_min", "airmass", ">="); 108 PXOPT_COPY_F32(config->args, where, "-airmass_max", "airmass", "<"); 117 109 PXOPT_COPY_F64(config->args, where, "-ra_min", "ra", ">="); 118 110 PXOPT_COPY_F64(config->args, where, "-ra_max", "ra", "<"); … … 157 149 PXOPT_LOOKUP_STR(region, config->args, "-set_region", false, false); 158 150 159 // default160 PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "==");161 162 151 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 163 152 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); … … 324 313 325 314 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 315 PXOPT_LOOKUP_BOOL(limit, config->args, "-limit", false); 326 316 327 317 // create a temp table to hold completely processed chipRuns 328 { 329 psString query = pxDataGet("flatcorr_create_tmp_chiprundone.sql"); 330 if (!query) { 331 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 332 return false; 333 } 334 335 if (!p_psDBRunQuery(config->dbh, query)) { 336 psError(PS_ERR_UNKNOWN, false, "database error"); 337 psFree(query); 338 return false; 339 } 340 341 psFree(query); 342 } 343 318 { 319 psString query = pxDataGet("flatcorr_create_tmp_chiprundone.sql"); 320 if (!query) { 321 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 322 return false; 323 } 324 325 if (!p_psDBRunQuery(config->dbh, query)) { 326 psError(PS_ERR_UNKNOWN, false, "database error"); 327 psFree(query); 328 return false; 329 } 330 331 psFree(query); 332 } 344 333 345 334 // find all completed chipRuns 346 { 347 psString query = pxDataGet("flatcorr_completely_processed_chiprun.sql"); 348 if (!query) { 349 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 350 return false; 351 } 352 353 if (!p_psDBRunQuery(config->dbh, query)) { 354 psError(PS_ERR_UNKNOWN, false, "database error"); 355 psFree(query); 356 return false; 357 } 358 359 psFree(query); 360 } 335 { 336 psString query = pxDataGet("flatcorr_completely_processed_chiprun.sql"); 337 if (!query) { 338 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 339 return false; 340 } 341 342 if (!p_psDBRunQuery(config->dbh, query)) { 343 psError(PS_ERR_UNKNOWN, false, "database error"); 344 psFree(query); 345 return false; 346 } 347 348 psFree(query); 349 } 350 361 351 // find flatcorrRun's that have had all of their chipRun's completed by 362 352 // comparing against the temp table … … 367 357 } 368 358 359 // treat limit == 0 as "no limit" 360 if (limit) { 361 psString limitString = psDBGenerateLimitSQL(limit); 362 psStringAppend(&query, " %s", limitString); 363 psFree(limitString); 364 } 365 369 366 if (!p_psDBRunQuery(config->dbh, query)) { 370 367 psError(PS_ERR_UNKNOWN, false, "database error"); … … 377 374 psErrorCode err = psErrorCodeLast(); 378 375 switch (err) { 379 case PS_ERR_DB_CLIENT:380 psError(PXTOOLS_ERR_SYS, false, "database error");381 case PS_ERR_DB_SERVER:382 psError(PXTOOLS_ERR_PROG, false, "database error");383 default:384 psError(PXTOOLS_ERR_PROG, false, "unknown error");376 case PS_ERR_DB_CLIENT: 377 psError(PXTOOLS_ERR_SYS, false, "database error"); 378 case PS_ERR_DB_SERVER: 379 psError(PXTOOLS_ERR_PROG, false, "database error"); 380 default: 381 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 385 382 } 386 383 … … 412 409 PS_ASSERT_PTR_NON_NULL(config, false); 413 410 411 psMetadata *where = psMetadataAlloc(); 412 PXOPT_COPY_S64(config->args, where, "-corr_id", "corr_id", "=="); 413 414 414 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 415 415 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); … … 422 422 } 423 423 424 if ( config->where) {425 psString whereClause = psDBGenerateWhereConditionSQL( config->where, NULL);424 if (psListLength(where->list)) { 425 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 426 426 psStringAppend(&query, " AND %s", whereClause); 427 427 psFree(whereClause); 428 428 } 429 psFree(where); 429 430 430 431 // treat limit == 0 as "no limit"
Note:
See TracChangeset
for help on using the changeset viewer.
