IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36996


Ignore:
Timestamp:
Jul 10, 2014, 4:04:51 PM (12 years ago)
Author:
eugene
Message:

do not require cpx, cpy files to exist or to be named in the header

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140610/Ohana/src/libdvo/src/dvo_catalog_split.c

    r36918 r36996  
    134134  if (!gfits_scan (&catalog[0].header, name,  "%s", 1, string)) {
    135135    free (path);
     136    // databases created prior to ~2014.07.01 did not have the LENSING or LENSOBJ paths in their headers.
     137    // in these cases, we do not try to lock or open the relevant file
     138    if (!strcmp (name, "LENSING")) return (DVO_CAT_OPEN_EMPTY);
     139    if (!strcmp (name, "LENSOBJ")) return (DVO_CAT_OPEN_EMPTY);
    136140    return (DVO_CAT_OPEN_FAIL);
    137141  }
     
    192196
    193197  /* get the components from the header - these duplicate information in the split files (NAXIS2) */
     198  // NSTARS, NMEAS, NMISS are required; NLENSING, NLENSOBJ are not (0 if not found)
    194199  if (!gfits_scan (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  &Naverage)) return (FALSE);
    195200  if (!gfits_scan (&catalog[0].header, "NMEAS",    OFF_T_FMT, 1,  &Nmeasure)) return (FALSE);
    196201  if (!gfits_scan (&catalog[0].header, "NMISS",    OFF_T_FMT, 1,  &Nmissing)) return (FALSE);
    197   if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d",   1,               &Nsecfilt)) Nsecfilt = 0;
    198   if (!gfits_scan (&catalog[0].header, "NLENSING", OFF_T_FMT, 1,  &Nlensing)) return (FALSE);
    199   if (!gfits_scan (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1,  &Nlensobj)) return (FALSE);
     202  if (!gfits_scan (&catalog[0].header, "NSECFILT",      "%d", 1,  &Nsecfilt)) Nsecfilt = 0;
     203  if (!gfits_scan (&catalog[0].header, "NLENSING", OFF_T_FMT, 1,  &Nlensing)) Nlensing = 0;
     204  if (!gfits_scan (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1,  &Nlensobj)) Nlensobj = 0;
    200205
    201206  /* the OBJID is a counter that uniquely defines an average entry and never changes.  if
     
    382387  /*** Lensing Table ***/
    383388  if (!(catalog[0].catflags & SKIP_LENSING)) {
    384     // unless we specify 'skip', we still need to load the
     389    // unless we specify 'skip', we still need to load the Lensing table
    385390    status = dvo_catalog_open_subcat (catalog, &catalog[0].lensing_catalog, ftable.header, "LENSING", VERBOSE);
    386391    if (status == DVO_CAT_OPEN_FAIL) {
    387392      return (FALSE);
    388393    }
     394    // the Lensing file need not exist, unless we expect data to exist
    389395    if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nlensing_disk > 0)) {
    390396      return (FALSE);
     
    392398  }
    393399  if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_LENSING)) {
    394     // XXX this allows an empty Lensing catalog with non-empty Average catalog : is that OK?
     400    // only read the Lensing table if the file actually exists
    395401    /* read Lensing table data */
    396402    if (!gfits_fread_ftable_data (catalog[0].lensing_catalog[0].f, &ftable, FALSE)) {
     
    406412    catalog[0].Nlensing_off = 0;
    407413  } else {
    408     // XXX is it necessary to generate a template header here?
    409     // XXX this is a memory leak, right?
    410414    if (catalog[0].lensing_catalog) {
    411415      gfits_free_header (&catalog[0].lensing_catalog[0].header);
     
    428432      return (FALSE);
    429433    }
     434    // the Lensobj file need not exist, unless we expect data to exist
    430435    if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nlensobj_disk > 0)) {
    431436      return (FALSE);
     
    433438  }
    434439  if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_LENSOBJ)) {
    435     // XXX this allows an empty Lensobj catalog with non-empty Average catalog : is that OK?
     440    // only read the Lensobj table if the file actually exists
    436441    /* read Lensobj table data */
    437442    if (!gfits_fread_ftable_data (catalog[0].lensobj_catalog[0].f, &ftable, FALSE)) {
     
    447452    catalog[0].Nlensobj_off = 0;
    448453  } else {
    449     // XXX is it necessary to generate a template header here?
    450     // XXX this is a memory leak, right?
    451454    if (catalog[0].lensobj_catalog) {
    452455      gfits_free_header (&catalog[0].lensobj_catalog[0].header);
Note: See TracChangeset for help on using the changeset viewer.