Changeset 14611
- Timestamp:
- Aug 22, 2007, 2:52:15 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20070817/psModules/src/config/pmConfig.c
r14505 r14611 4 4 * @author EAM (IfA) 5 5 * 6 * @version $Revision: 1.101 $ $Name: not supported by cvs2svn $7 * @date $Date: 2007-08- 15 20:21:18$6 * @version $Revision: 1.101.2.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-08-23 00:52:15 $ 8 8 * 9 9 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 295 295 // Read the calibrations for a camera 296 296 static bool cameraReadCalibrations(psMetadata *camera, // Camera for which to read the formats 297 const char * name // Name of the camera, for error messages297 const char *cameraName // Name of the camera, for error messages 298 298 ) 299 299 { 300 300 assert(camera); 301 assert( name);301 assert(cameraName); 302 302 303 303 psMetadataItem *darkNorm = psMetadataLookup(camera, "DARK.NORM"); // The dark normalisation calibration … … 305 305 if (darkNorm->type == PS_DATA_STRING) { 306 306 const char *darkNormName = darkNorm->data.str; // The file name 307 psTrace("config", 2, "Reading %s dark normalisation: %s\n", name, darkNormName);307 psTrace("config", 2, "Reading %s dark normalisation: %s\n", cameraName, darkNormName); 308 308 psMetadata *new = NULL; // New metadata 309 309 if (!pmConfigFileRead(&new, darkNormName, "Dark normalisation")) { 310 310 psError(PM_ERR_CONFIG, false, "Trouble reading reading %s dark normalisation %s --- " 311 "ignored.\n", name, darkNormName);311 "ignored.\n", cameraName, darkNormName); 312 312 psFree(new); 313 313 return false; … … 320 320 darkNorm->data.md = new; 321 321 } else if (darkNorm->type != PS_DATA_METADATA) { 322 psWarning("DARK.NORM in camera %s is not of type STR or METADATA (%x)", name, darkNorm->type);322 psWarning("DARK.NORM in camera %s is not of type STR or METADATA (%x)", cameraName, darkNorm->type); 323 323 } 324 324 } else { … … 541 541 "ignored.\n"); 542 542 } else { 543 char *cameraFile = argv[argNum]; // The camera configuration file to read544 545 // look for a symbolic camera name in the CAMERAS metadata546 // otherwise fall back to trying the -camera option as a literal547 // filename548 543 bool mdok = true; // Status of MD lookup 544 char *cameraName = argv[argNum]; // symbolic name of the camera 545 546 // look for the CAMERAS list in config->site 549 547 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->site, "CAMERAS"); 550 if (mdok && cameras) { 551 char *newFile = psMetadataLookupStr(NULL, cameras, cameraFile); // The filename 552 if (newFile) { 553 cameraFile = newFile; 554 } else { 555 psLogMsg ("psModules.config", PS_LOG_INFO, 556 "%s is not listed in the site CAMERAS list,\n" 557 "trying as a camera configuration file\n", cameraFile); 558 } 559 } else { 548 if (!cameras) { 560 549 psError(PS_ERR_IO, false, "Unable to find CAMERAS in site configuration.\n"); 561 550 psFree(config); … … 563 552 } 564 553 565 if (!pmConfigFileRead(&config->camera, cameraFile, "camera")) { 566 psError(PM_ERR_CONFIG, false, "Problem reading %s", cameraFile); 554 // look for the symbolic camera name in the CAMERAS metadata 555 char *cameraFile = psMetadataLookupStr(&mdok, cameras, cameraName); // The filename 556 if (!cameraFile) { 557 psError(PS_ERR_IO, false, "%s is not listed in the site CAMERAS list\n", cameraName); 567 558 psFree(config); 568 559 return NULL; 569 560 } 570 561 562 // load this camera's configuration informatoin 563 if (!pmConfigFileRead(&config->camera, cameraFile, "camera")) { 564 psError(PM_ERR_CONFIG, false, "Problem reading %s", cameraName); 565 psFree(config); 566 return NULL; 567 } 568 // save the name for future uses 569 config->cameraName = psStringCopy (cameraName); 570 571 571 psArgumentRemove(argNum, argc, argv); 572 572 … … 580 580 581 581 // Read in any camera-specific calibrations 582 if (!cameraReadCalibrations(config->camera, camera File)) {582 if (!cameraReadCalibrations(config->camera, cameraName)) { 583 583 psError(PS_ERR_UNKNOWN, false, 584 584 "Unable to read calibrations within camera configuration %s.\n", 585 camera File);585 cameraName); 586 586 psFree(config); 587 587 return NULL; 588 588 } 589 589 590 psMetadataAddMetadata(cameras, PS_LIST_HEAD, camera File, PS_META_REPLACE,590 psMetadataAddMetadata(cameras, PS_LIST_HEAD, cameraName, PS_META_REPLACE, 591 591 "Camera specified on command line", config->camera); 592 592 593 if (!pmConfigCameraSkycellVersion(config->site, camera File)) {593 if (!pmConfigCameraSkycellVersion(config->site, cameraName)) { 594 594 psError(PS_ERR_UNKNOWN, false, 595 595 "Unable to generate skycell versions of specified camera %s.\n", 596 camera File);596 cameraName); 597 597 psFree(config); 598 598 return NULL; 599 599 } 600 600 601 if (!pmConfigCameraMosaickedVersions(config->site, camera File)) {601 if (!pmConfigCameraMosaickedVersions(config->site, cameraName)) { 602 602 psError(PS_ERR_UNKNOWN, false, 603 603 "Unable to generate mosaicked versions of specified camera %s.\n", 604 camera File);604 cameraName); 605 605 psFree(config); 606 606 return NULL; … … 875 875 assert(camera); 876 876 assert(header); 877 assert(cameraName && strlen(cameraName) > 0); 877 assert(cameraName); 878 assert(*cameraName); 878 879 879 880 bool result = false; // Did we find the first match? … … 1008 1009 psFree(name); 1009 1010 } 1010 return format;1011 return psMemIncrRefCounter(format); 1011 1012 } 1012 1013
Note:
See TracChangeset
for help on using the changeset viewer.
