Changeset 12391 for trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
- Timestamp:
- Mar 9, 2007, 3:19:11 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
r12332 r12391 230 230 } 231 231 232 /* make sure header is consistent with data */233 gfits_modify (&catalog[0].header, "NSTARS", "%d", 1, catalog[0].Naverage);234 gfits_modify (&catalog[0].header, "NMEAS", "%d", 1, catalog[0].Nmeasure);235 gfits_modify (&catalog[0].header, "NMISS", "%d", 1, catalog[0].Nmissing);236 gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, catalog[0].Nsecfilt);237 238 /* specify the appropriate data format */239 if (catalog[0].catformat == DVO_FORMAT_INTERNAL) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "INTERNAL");240 if (catalog[0].catformat == DVO_FORMAT_LONEOS) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "LONEOS");241 if (catalog[0].catformat == DVO_FORMAT_ELIXIR) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "ELIXIR");242 if (catalog[0].catformat == DVO_FORMAT_PANSTARRS_DEV_0) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_0");243 // if (catalog[0].catformat == DVO_FORMAT_PANSTARRS) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS");244 // if (catalog[0].catformat == DVO_FORMAT_PMTEST) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PMTEST");245 246 /* rewind file pointers and truncate file */247 f = catalog[0].f;248 fseek (f, 0, SEEK_SET);249 ftruncate (fileno (catalog[0].f), 0);250 251 /* write header data (use gfits_write_header?) */252 nitems = fwrite (catalog[0].header.buffer, 1, catalog[0].header.size, f);253 if (nitems != catalog[0].header.size) {254 if (VERBOSE) fprintf (stderr, "failed to write header\n");255 return (FALSE);256 }257 258 232 /* for the appropriate types, pull out the first secfilt and pass to WriteRawAverage as primary */ 259 233 if ((catalog[0].catformat == DVO_FORMAT_ELIXIR) || // special case for ELIXIR … … 277 251 } 278 252 253 /* make sure header is consistent with data */ 254 gfits_modify (&catalog[0].header, "NSTARS", "%d", 1, catalog[0].Naverage); 255 gfits_modify (&catalog[0].header, "NMEAS", "%d", 1, catalog[0].Nmeasure); 256 gfits_modify (&catalog[0].header, "NMISS", "%d", 1, catalog[0].Nmissing); 257 gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, catalog[0].Nsecfilt); 258 259 /* specify the appropriate data format */ 260 if (catalog[0].catformat == DVO_FORMAT_INTERNAL) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "INTERNAL"); 261 if (catalog[0].catformat == DVO_FORMAT_LONEOS) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "LONEOS"); 262 if (catalog[0].catformat == DVO_FORMAT_ELIXIR) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "ELIXIR"); 263 if (catalog[0].catformat == DVO_FORMAT_PANSTARRS_DEV_0) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_0"); 264 // if (catalog[0].catformat == DVO_FORMAT_PANSTARRS) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS"); 265 // if (catalog[0].catformat == DVO_FORMAT_PMTEST) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PMTEST"); 266 267 /* rewind file pointers and truncate file */ 268 f = catalog[0].f; 269 fseek (f, 0, SEEK_SET); 270 ftruncate (fileno (catalog[0].f), 0); 271 272 /* write header data (use gfits_write_header?) */ 273 nitems = fwrite (catalog[0].header.buffer, 1, catalog[0].header.size, f); 274 if (nitems != catalog[0].header.size) { 275 if (VERBOSE) fprintf (stderr, "failed to write header\n"); 276 goto failure; 277 } 278 279 279 /* write averages and measures */ 280 280 WriteRawAverage (f, catalog[0].average, catalog[0].Naverage, catalog[0].catformat, primary); … … 287 287 if (nitems != Nitems) { 288 288 if (VERBOSE) fprintf (stderr, "failed to write catalog file missing %s\n", catalog[0].filename); 289 return (FALSE);289 goto failure; 290 290 } 291 291 … … 298 298 free (secfilt); 299 299 } 300 301 300 return (TRUE); 301 302 failure: 303 /* free temp storage */ 304 if (primary != NULL) { 305 free (primary); 306 free (secfilt); 307 } 308 return (FALSE); 302 309 } 303 310
Note:
See TracChangeset
for help on using the changeset viewer.
