- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
psastro/src/psastroMetadataStats.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/psastro/src/psastroMetadataStats.c
r23835 r27840 31 31 pmFPAview *view = pmFPAviewAlloc(0); 32 32 33 // Entries in the PSASTRO.HEADER in the FPA don't get seen by ppStats 34 psMetadata *header = psMetadataLookupMetadata(&status, output->fpa->analysis, "PSASTRO.HEADER"); 35 if (status && header) { 36 psMetadataItemSupplement(&status, stats, header, "ZPT_OBS"); 37 psMetadataItemSupplement(&status, stats, header, "ZPT_ERR"); 38 psMetadataItemSupplement(&status, stats, header, "CERROR"); 39 psMetadataItemSupplement(&status, stats, header, "NASTRO"); 40 } 41 33 42 if (!ppStatsMetadata(stats, output->fpa, view, 0, config)) { 34 43 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image."); … … 37 46 } 38 47 48 psFree(view); 49 39 50 // if we did not request any specific stats, the structure is empty 40 51 if (stats && stats->list->n == 0) { 41 52 psWarning ("stats output specified, but no requested stats entries in headers"); 42 psFree(view);43 53 return true; 44 54 } … … 53 63 // convert to a real UNIX filename 54 64 psString resolved = pmConfigConvertFilename(filename, config, true, false); // Resolved filename 65 if (!resolved) { 66 psError(psErrorCodeLast(), false, "Unable to resolve statistics filename: %s", filename); 67 psFree(statsMDC); 68 return false; 69 } 55 70 FILE *statsFile = fopen (resolved, "w"); 56 71 if (!statsFile) { 57 72 psError(PS_ERR_IO, true, "Unable to open statistics file %s for writing.\n", resolved); 58 psFree(view);59 73 psFree(statsMDC); 60 74 psFree(resolved); … … 63 77 64 78 // write the stats MDC to a file 65 fprintf(statsFile, "%s", statsMDC); 66 fclose(statsFile); 79 if (fprintf(statsFile, "%s", statsMDC) != strlen(statsMDC)) { 80 psError(PS_ERR_IO, false, "Unable to write statistics file %s", resolved); 81 psFree(statsMDC); 82 psFree(resolved); 83 return false; 84 } 85 psFree(statsMDC); 86 if (fclose(statsFile) == EOF) { 87 psError(PS_ERR_IO, false, "Unable to write statistics file %s", resolved); 88 psFree(resolved); 89 return false; 90 } 91 92 psFree(resolved); 67 93 68 94 pmConfigRunFilenameAddWrite(config, "STATS", filename); 69 95 70 psFree(resolved);71 psFree(statsMDC);72 psFree(view);73 96 return true; 74 97 }
Note:
See TracChangeset
for help on using the changeset viewer.
