IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 9, 2007, 3:19:11 PM (19 years ago)
Author:
eugene
Message:

inconsistency with NSECFILT in output tables for ELIXIR and LONEOS formats

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c

    r12332 r12391  
    230230  }
    231231
    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 
    258232  /* for the appropriate types, pull out the first secfilt and pass to WriteRawAverage as primary */
    259233  if ((catalog[0].catformat == DVO_FORMAT_ELIXIR) || // special case for ELIXIR
     
    277251  }
    278252
     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
    279279  /* write averages and measures */
    280280  WriteRawAverage (f, catalog[0].average, catalog[0].Naverage, catalog[0].catformat, primary);
     
    287287  if (nitems != Nitems) {
    288288    if (VERBOSE) fprintf (stderr, "failed to write catalog file missing %s\n", catalog[0].filename);
    289     return (FALSE);
     289    goto failure;
    290290  }
    291291
     
    298298    free (secfilt);
    299299  }
    300 
    301300  return (TRUE);
     301
     302failure:
     303  /* free temp storage */
     304  if (primary != NULL) {
     305    free (primary);
     306    free (secfilt);
     307  }
     308  return (FALSE);
    302309}
    303310
Note: See TracChangeset for help on using the changeset viewer.