Changeset 33649 for trunk/Ohana/src/libdvo/src/dvo_catalog_mef.c
- Timestamp:
- Apr 1, 2012, 2:28:17 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libdvo/src/dvo_catalog_mef.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libdvo/src/dvo_catalog_mef.c
r29938 r33649 3 3 int dvo_catalog_load_mef (Catalog *catalog, int VERBOSE) { 4 4 5 off_t Nbytes; 6 off_t Naverage; 7 off_t Nmeasure; 8 off_t Nmissing; 9 off_t Nitems, Nexpect; 5 10 int Nsecfilt; 6 off_t Nitems, Nbytes, Nexpect, Naverage, Nmeasure, Nmissing;7 FILE *f;8 11 9 12 Header header; 10 Matrix matrix;11 13 FTable ftable; 12 SecFilt *primary; 13 14 f = catalog[0].f; 14 15 SecFilt *primary = NULL; 16 15 17 ftable.header = &header; 16 18 17 /* move pointer past header -- must be already read (load_catalog) */18 fseeko (f, catalog[0].header.datasize, SEEK_SET);19 20 /* matrix should be empty */21 if (!gfits_fread_matrix (f, &matrix, &catalog[0].header)) {22 if (VERBOSE) fprintf (stderr, "can't read primary matrix");23 return (FALSE);24 }25 19 /* get the components from the header */ 26 20 if (!gfits_scan (&catalog[0].header, "NSTARS", OFF_T_FMT, 1, &Naverage)) return (FALSE); … … 57 51 catalog[0].secfilt = NULL; 58 52 59 /* validate table mode */ 53 /* validate table mode ?*/ 54 55 /*** Average Table ***/ 56 57 /* need to read the table header to determine format (whether or not we read averages) */ 58 /* move pointer past PHU header -- must be already read (load_catalog) */ 59 Nbytes = catalog[0].header.datasize + gfits_data_size (&catalog[0].header); 60 fseeko (catalog[0].f, Nbytes, SEEK_SET); 60 61 61 62 /* read Average table header */ 62 if (!gfits_fread_header ( f, &header)) {63 if (!gfits_fread_header (catalog[0].f, &header)) { 63 64 if (VERBOSE) fprintf (stderr, "can't read table average header"); 64 65 return (FALSE); 65 66 } 67 66 68 /* read Average table data (or skip) */ 67 69 if (catalog[0].catflags & LOAD_AVES) { 68 if (!gfits_fread_ftable_data ( f, &ftable, FALSE)) {70 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { 69 71 if (VERBOSE) fprintf (stderr, "can't read table average data"); 70 72 return (FALSE); … … 78 80 catalog[0].Naves_off = 0; 79 81 } else { 82 catalog[0].catformat = FtableGetFormat (&ftable); 80 83 Nbytes = gfits_data_size (&header); 81 fseeko ( f, Nbytes, SEEK_CUR);84 fseeko (catalog[0].f, Nbytes, SEEK_CUR); 82 85 ALLOCATE (catalog[0].average, Average, 1); 83 86 catalog[0].Naverage = 0; … … 88 91 89 92 /* read Measure table header */ 90 if (!gfits_fread_header ( f, &header)) {93 if (!gfits_fread_header (catalog[0].f, &header)) { 91 94 if (VERBOSE) fprintf (stderr, "can't read table measure header"); 92 95 return (FALSE); … … 94 97 /* read Measure table data */ 95 98 if (catalog[0].catflags & LOAD_MEAS) { 96 if (!gfits_fread_ftable_data ( f, &ftable, FALSE)) {99 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { 97 100 if (VERBOSE) fprintf (stderr, "can't read table measure data"); 98 101 return (FALSE); … … 106 109 } else { 107 110 Nbytes = gfits_data_size (&header); 108 fseeko ( f, Nbytes, SEEK_CUR);111 fseeko (catalog[0].f, Nbytes, SEEK_CUR); 109 112 ALLOCATE (catalog[0].measure, Measure, 1); 110 113 catalog[0].Nmeasure = 0; … … 113 116 114 117 /* read Missing table header */ 115 if (!gfits_fread_header ( f, &header)) {118 if (!gfits_fread_header (catalog[0].f, &header)) { 116 119 if (VERBOSE) fprintf (stderr, "can't read table missing header"); 117 120 return (FALSE); … … 119 122 /* read Missing table data */ 120 123 if (catalog[0].catflags & LOAD_MISS) { 121 if (!gfits_fread_ftable_data ( f, &ftable, FALSE)) {124 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { 122 125 if (VERBOSE) fprintf (stderr, "can't read table missing data"); 123 126 return (FALSE); … … 136 139 } else { 137 140 Nbytes = gfits_data_size (&header); 138 fseeko ( f, Nbytes, SEEK_CUR);141 fseeko (catalog[0].f, Nbytes, SEEK_CUR); 139 142 ALLOCATE (catalog[0].missing, Missing, 1); 140 143 catalog[0].Nmissing = 0; … … 143 146 144 147 /* read secfilt table header */ 145 if (!gfits_fread_header ( f, &header)) {148 if (!gfits_fread_header (catalog[0].f, &header)) { 146 149 if (VERBOSE) fprintf (stderr, "can't read table secfilt header"); 147 150 return (FALSE); … … 149 152 /* read secfilt table data */ 150 153 if (catalog[0].catflags & LOAD_SECF) { 151 if (!gfits_fread_ftable_data ( f, &ftable, FALSE)) {154 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { 152 155 if (VERBOSE) fprintf (stderr, "can't read table secfilt data"); 153 156 return (FALSE); … … 187 190 /* no real need to skip the data array here... */ 188 191 Nbytes = gfits_data_size (&header); 189 fseeko ( f, Nbytes, SEEK_CUR);192 fseeko (catalog[0].f, Nbytes, SEEK_CUR); 190 193 if (primary != NULL) { 191 194 free (primary);
Note:
See TracChangeset
for help on using the changeset viewer.
