Changeset 17489
- Timestamp:
- Apr 28, 2008, 11:13:46 AM (18 years ago)
- Location:
- trunk/psModules/src
- Files:
-
- 3 edited
-
camera/pmFPAfileDefine.c (modified) (5 diffs)
-
config/pmConfig.c (modified) (1 diff)
-
config/pmConfig.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfileDefine.c
r16611 r17489 172 172 } 173 173 174 psMetadata * data= pmConfigFileRule(config, camera, name); // File rule175 if (! data) {174 psMetadata *filerule = pmConfigFileRule(config, camera, name); // File rule 175 if (!filerule) { 176 176 psError(PS_ERR_IO, true, "Can't find file rule %s!", name); 177 177 return NULL; … … 183 183 file->name = psStringCopy(name); 184 184 185 file->filerule = psMemIncrRefCounter(psMetadataLookupStr(&status, data, "FILENAME.RULE")); 186 187 const char *type = psMetadataLookupStr(&status, data, "FILE.TYPE"); 185 // this is the filename rule 186 file->filerule = psMemIncrRefCounter(psMetadataLookupStr(&status, filerule, "FILENAME.RULE")); 187 188 const char *type = psMetadataLookupStr(&status, filerule, "FILE.TYPE"); 188 189 file->type = pmFPAfileTypeFromString(type); 189 190 if (file->type == PM_FPA_FILE_NONE) { … … 214 215 if (!formatName || strlen(formatName) == 0) { 215 216 // select the format list from the selected camera 216 formatName = psMetadataLookupStr(&status, data, "FILE.FORMAT");217 formatName = psMetadataLookupStr(&status, filerule, "FILE.FORMAT"); 217 218 if (!formatName || strcmp(formatName, "NONE") == 0) { 218 219 // Try to get by with the default … … 238 239 239 240 // Get FITS output scheme 240 const char *fitsType = psMetadataLookupStr(&status, data, "FITS.TYPE"); // Name of FITS scheme to use241 const char *fitsType = psMetadataLookupStr(&status, filerule, "FITS.TYPE"); // Name of FITS scheme to use 241 242 if (fitsType && strcasecmp(fitsType, "NONE") != 0) { 242 psMetadata *fitsTypes = psMetadataLookupMetadata(&status, camera, "FITS"); // The FITS schemes 243 if (!fitsTypes) { 244 psWarning("Unable to find FITS in camera configuration."); 245 goto FITS_OPTIONS_DONE; 246 } 247 psMetadata *scheme = psMetadataLookupMetadata(NULL, fitsTypes, fitsType); // FITS scheme 243 244 // load the FITSTYPE scheme for this file 245 psMetadata *scheme = pmConfigFitsType(config, camera, fitsType); // File rule 248 246 if (!scheme) { 247 // XXX change to a config error? 249 248 psWarning("Unable to find %s in FITS in camera configuration --- will use defaults.", fitsType); 250 249 goto FITS_OPTIONS_DONE; … … 337 336 } 338 337 339 file->dataLevel = pmFPALevelFromName(psMetadataLookupStr(&status, data, "DATA.LEVEL"));338 file->dataLevel = pmFPALevelFromName(psMetadataLookupStr(&status, filerule, "DATA.LEVEL")); 340 339 if (file->dataLevel == PM_FPA_LEVEL_NONE) { 341 340 psError(PS_ERR_IO, true, "DATA.LEVEL is not set for %s\n", name); -
trunk/psModules/src/config/pmConfig.c
r17264 r17489 1513 1513 } 1514 1514 1515 psMetadata *pmConfigFitsType (const pmConfig *config, const psMetadata *camera, const char *fitsType) 1516 { 1517 bool mdok; 1518 1519 PS_ASSERT_PTR_NON_NULL(config, NULL); 1520 PS_ASSERT_METADATA_NON_NULL(camera, NULL); 1521 PS_ASSERT_STRING_NON_EMPTY(fitsType, NULL); 1522 1523 psMetadataItem *item = psMetadataLookup(camera, "FITSTYPES"); // Item with the file rule of interest 1524 if (!item) { 1525 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find FITSTYPES in the camera configuration."); 1526 return NULL; 1527 } 1528 1529 if (!metadataItemReadFile(item, "FITS Types")) { 1530 psError(PM_ERR_CONFIG, false, "Unable to read file rules for camera."); 1531 return NULL; 1532 } 1533 1534 assert(item->type == PS_DATA_METADATA); 1535 psMetadata *fitstypes = item->data.md; // FITS Types from the camera configuration 1536 1537 // select the name from the FITSTYPES 1538 psMetadata *scheme = psMetadataLookupMetadata(&mdok, fitstypes, fitsType); 1539 if (!scheme) { 1540 psWarning("Unable to find specified FITS Type %s in camera configuration.", fitsType); 1541 return NULL; 1542 } 1543 1544 return scheme; 1545 } -
trunk/psModules/src/config/pmConfig.h
r16611 r17489 5 5 * @author Eugene Magnier, IfA 6 6 * 7 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $8 * @date $Date: 2008-0 2-22 20:20:38$7 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-04-28 21:13:46 $ 9 9 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 10 10 */ … … 176 176 ); 177 177 178 // look up the specified fitstype, interpolating the file if needed 179 psMetadata *pmConfigFitsType (const pmConfig *config, const psMetadata *camera, const char *fitsType); 180 178 181 /// @} 179 182 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
