IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2012, 2:28:17 PM (14 years ago)
Author:
eugene
Message:

new query fields (secfilt flags; mean airmass; mcal offset, photcode_klam, photcode_c); updates to the measure,average,secfilt bit flags (relphot & relastr); support for distributed hosts & flat-field corrections in dvo; support for PS1_V3 schema; remove strdup from code (break ohana memory management); better support for Average,Measure Tiny values (used by relphot and relastro)

File:
1 edited

Legend:

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

    r29938 r33649  
    33int dvo_catalog_load_mef (Catalog *catalog, int VERBOSE) {
    44 
     5  off_t Nbytes;
     6  off_t Naverage;
     7  off_t Nmeasure;
     8  off_t Nmissing;
     9  off_t Nitems, Nexpect;
    510  int Nsecfilt;
    6   off_t Nitems, Nbytes, Nexpect, Naverage, Nmeasure, Nmissing;
    7   FILE *f;
    811
    912  Header header;
    10   Matrix matrix;
    1113  FTable ftable;
    12   SecFilt *primary;
    13 
    14   f = catalog[0].f;
     14
     15  SecFilt *primary = NULL;
     16
    1517  ftable.header = &header;
    1618
    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   }
    2519  /* get the components from the header */
    2620  if (!gfits_scan (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  &Naverage)) return (FALSE);
     
    5751  catalog[0].secfilt = NULL;
    5852
    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);
    6061
    6162  /* read Average table header */
    62   if (!gfits_fread_header (f, &header)) {
     63  if (!gfits_fread_header (catalog[0].f, &header)) {
    6364    if (VERBOSE) fprintf (stderr, "can't read table average header");
    6465    return (FALSE);
    6566  }
     67
    6668  /* read Average table data (or skip) */
    6769  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)) {
    6971      if (VERBOSE) fprintf (stderr, "can't read table average data");
    7072      return (FALSE);
     
    7880    catalog[0].Naves_off = 0;
    7981  } else {
     82    catalog[0].catformat = FtableGetFormat (&ftable);
    8083    Nbytes = gfits_data_size (&header);
    81     fseeko (f, Nbytes, SEEK_CUR);
     84    fseeko (catalog[0].f, Nbytes, SEEK_CUR);
    8285    ALLOCATE (catalog[0].average, Average, 1);
    8386    catalog[0].Naverage = 0;
     
    8891
    8992  /* read Measure table header */
    90   if (!gfits_fread_header (f, &header)) {
     93  if (!gfits_fread_header (catalog[0].f, &header)) {
    9194    if (VERBOSE) fprintf (stderr, "can't read table measure header");
    9295    return (FALSE);
     
    9497  /* read Measure table data */
    9598  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)) {
    97100      if (VERBOSE) fprintf (stderr, "can't read table measure data");
    98101      return (FALSE);
     
    106109  } else {
    107110    Nbytes = gfits_data_size (&header);
    108     fseeko (f, Nbytes, SEEK_CUR);
     111    fseeko (catalog[0].f, Nbytes, SEEK_CUR);
    109112    ALLOCATE (catalog[0].measure, Measure, 1);
    110113    catalog[0].Nmeasure = 0;
     
    113116
    114117  /* read Missing table header */
    115   if (!gfits_fread_header (f, &header)) {
     118  if (!gfits_fread_header (catalog[0].f, &header)) {
    116119    if (VERBOSE) fprintf (stderr, "can't read table missing header");
    117120    return (FALSE);
     
    119122  /* read Missing table data */
    120123  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)) {
    122125      if (VERBOSE) fprintf (stderr, "can't read table missing data");
    123126      return (FALSE);
     
    136139  } else {
    137140    Nbytes = gfits_data_size (&header);
    138     fseeko (f, Nbytes, SEEK_CUR);
     141    fseeko (catalog[0].f, Nbytes, SEEK_CUR);
    139142    ALLOCATE (catalog[0].missing, Missing, 1);
    140143    catalog[0].Nmissing = 0;
     
    143146
    144147  /* read secfilt table header */
    145   if (!gfits_fread_header (f, &header)) {
     148  if (!gfits_fread_header (catalog[0].f, &header)) {
    146149    if (VERBOSE) fprintf (stderr, "can't read table secfilt header");
    147150    return (FALSE);
     
    149152  /* read secfilt table data */
    150153  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)) {
    152155      if (VERBOSE) fprintf (stderr, "can't read table secfilt data");
    153156      return (FALSE);
     
    187190    /* no real need to skip the data array here... */
    188191    Nbytes = gfits_data_size (&header);
    189     fseeko (f, Nbytes, SEEK_CUR);
     192    fseeko (catalog[0].f, Nbytes, SEEK_CUR);
    190193    if (primary != NULL) {
    191194      free (primary);
Note: See TracChangeset for help on using the changeset viewer.