Changeset 17911 for trunk/psModules/src/camera/pmFPAfileIO.c
- Timestamp:
- Jun 4, 2008, 3:32:28 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAfileIO.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfileIO.c
r17832 r17911 263 263 } 264 264 265 pmFPA *nameSource = file->src; // Source of FPA. NAME265 pmFPA *nameSource = file->src; // Source of FPA.OBS 266 266 if (!nameSource) { 267 267 nameSource = file->fpa; 268 268 } 269 269 bool mdok; // Status of MD lookup 270 const char *fpaname = psMetadataLookupStr(&mdok, nameSource->concepts, "FPA.NAME"); // Name of FPA 271 272 pmFPAAddSourceFromView(file->fpa, fpaname, view, format); 273 psTrace ("psModules.camera", 5, "created fpa data elements for %s (%s) (%d:%d:%d)\n", file->name, file->name, view->chip, view->cell, view->readout); 270 const char *fpaObs = psMetadataLookupStr(&mdok, nameSource->concepts, "FPA.OBS"); // Obs. id 271 272 pmFPAAddSourceFromView(file->fpa, fpaObs, view, format); 273 psTrace ("psModules.camera", 5, "created fpa data elements for %s (%s) (%d:%d:%d)\n", 274 file->name, file->name, view->chip, view->cell, view->readout); 274 275 break; 275 276 } … … 349 350 // (existing) fpa 350 351 if (file->type == PM_FPA_FILE_CMF) { 351 if (!pmFPAviewCheckDataStatusForSources (view, file)) {352 if (!pmFPAviewCheckDataStatusForSources (view, file)) { 352 353 psTrace("psModules.camera", 6, "skip write for %s, no data for this entry", file->name); 353 354 return true; … … 778 779 file->fits->options = psMemIncrRefCounter(file->options); 779 780 780 // in most cases, we have already open and read the phu and determined the format.781 // in some cases, (eg DetDB images), we have only just determined the filename.782 // we need to check the file format before we can work with the file783 if (!file->format) {784 psMetadata *phu = psFitsReadHeader (NULL, file->fits);785 if (!phu) {786 psError(PS_ERR_IO, false, "Failed to read file header %s\n", file->filename);787 return false;788 }789 790 // determine the current format from the header791 // determine camera if not specified already792 file->format = pmConfigCameraFormatFromHeader (config, phu, true);793 if (!file->format) {794 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", file->filename);795 psFree(phu);796 return false;797 }798 psFree(phu);799 }800 801 // if needed, set the optional EXTWORD field based on the camera value802 psMetadata *fileMenu = psMetadataLookupMetadata (NULL, file->format, "FILE");803 if (!fileMenu) {804 psError (PS_ERR_IO, true, "FILE METADATA missing from camera format %s\n",805 config->formatName);806 return false;807 }808 char *extword = psMetadataLookupStr (&status, fileMenu, "EXTWORD");809 if (status) {810 psFitsSetExtnameWord (file->fits, extword);811 }781 // in most cases, we have already open and read the phu and determined the format. 782 // in some cases, (eg DetDB images), we have only just determined the filename. 783 // we need to check the file format before we can work with the file 784 if (!file->format) { 785 psMetadata *phu = psFitsReadHeader (NULL, file->fits); 786 if (!phu) { 787 psError(PS_ERR_IO, false, "Failed to read file header %s\n", file->filename); 788 return false; 789 } 790 791 // determine the current format from the header 792 // determine camera if not specified already 793 file->format = pmConfigCameraFormatFromHeader (config, phu, true); 794 if (!file->format) { 795 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", file->filename); 796 psFree(phu); 797 return false; 798 } 799 psFree(phu); 800 } 801 802 // if needed, set the optional EXTWORD field based on the camera value 803 psMetadata *fileMenu = psMetadataLookupMetadata (NULL, file->format, "FILE"); 804 if (!fileMenu) { 805 psError (PS_ERR_IO, true, "FILE METADATA missing from camera format %s\n", 806 config->formatName); 807 return false; 808 } 809 char *extword = psMetadataLookupStr (&status, fileMenu, "EXTWORD"); 810 if (status) { 811 psFitsSetExtnameWord (file->fits, extword); 812 } 812 813 813 814 // XXX these are probably only needed for WRITE files
Note:
See TracChangeset
for help on using the changeset viewer.
