IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

control dvomerge by -region; dvomerge should not require both to have input images; input databases only need to have a SOFT lock (read-only)

Location:
branches/eam_branches/ipp-20120405/Ohana/src/dvomerge/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120405/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c

    r31450 r33738  
    116116  int status;
    117117 
     118  IDmap->old = NULL;
     119  IDmap->new = NULL;
     120
     121  // it is OK if there are no images in the database, but there should be no imageIDs to map...
     122  if (in->dbstate == LCK_EMPTY) {
     123    return TRUE;
     124  }
     125
    118126  images = gfits_table_get_Image (&in[0].ftable, &Nimages, &in[0].swapped);
    119127  if (!images) {
     
    199207    if (oldID == 0) continue;
    200208
     209    if (!IDmap->old) {
     210      fprintf (stderr, "input database has image IDs, but no Image table\n");
     211    }
     212
    201213    newID = dvo_map_image_ID (IDmap, oldID);
    202214    if (newID == 0) {
  • branches/eam_branches/ipp-20120405/Ohana/src/dvomerge/src/dvomergeCreate.c

    r33657 r33738  
    124124  depth2 = insky2[0].regions[Ns].depth;
    125125
     126  SkyList *outlist = SkyListByPatch (outsky, -1, &UserPatch);
     127
    126128  // loop over the populatable output regions
    127   for (i = 0; i < outsky[0].Nregions; i++) {
    128     if (!outsky[0].regions[i].table) continue;
    129     if (VERBOSE) fprintf (stderr, "output: %s\n", outsky[0].regions[i].name);
     129  for (i = 0; i < outlist[0].Nregions; i++) {
     130    if (!outlist[0].regions[i][0].table) continue;
     131    if (VERBOSE) fprintf (stderr, "output: %s\n", outlist[0].regions[i][0].name);
    130132
    131133    // load / create output catalog
    132     LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w", NsecfiltOutput);
     134    LoadCatalog (&outcatalog, outlist[0].regions[i], outlist[0].filename[i], "w", NsecfiltOutput);
    133135
    134136    // combine only tables at equal or larger depth
    135137     
    136138    // load in all of the tables from input1 for this region
    137     inlist = SkyListByBounds (insky1, depth1, outsky[0].regions[i].Rmin, outsky[0].regions[i].Rmax, outsky[0].regions[i].Dmin, outsky[0].regions[i].Dmax);
     139    inlist = SkyListByBounds (insky1, depth1, outlist[0].regions[i][0].Rmin + 0.01, outlist[0].regions[i][0].Rmax - 0.01, outlist[0].regions[i][0].Dmin + 0.01, outlist[0].regions[i][0].Dmax - 0.01);
    138140    for (j = 0; j < inlist[0].Nregions; j++) {
    139141      if (VERBOSE) fprintf (stderr, "input 1: %s\n", inlist[0].regions[j][0].name);
     
    149151      }
    150152      dvo_update_image_IDs (&IDmap1, &incatalog);
    151       merge_catalogs_new (&outsky[0].regions[i], &outcatalog, &incatalog, secfiltMap1);
     153      merge_catalogs_new (outlist[0].regions[i], &outcatalog, &incatalog, secfiltMap1);
    152154      dvo_catalog_unlock (&incatalog);
    153155      dvo_catalog_free (&incatalog);
     
    156158
    157159    // load in all of the tables from input2 for this region
    158     inlist = SkyListByBounds (insky2, depth2, outsky[0].regions[i].Rmin, outsky[0].regions[i].Rmax, outsky[0].regions[i].Dmin, outsky[0].regions[i].Dmax);
     160    inlist = SkyListByBounds (insky2, depth2, outlist[0].regions[i][0].Rmin + 0.01, outlist[0].regions[i][0].Rmax - 0.01, outlist[0].regions[i][0].Dmin + 0.01, outlist[0].regions[i][0].Dmax - 0.01);
    159161    for (j = 0; j < inlist[0].Nregions; j++) {
    160162      if (VERBOSE) fprintf (stderr, "input 2: %s\n", inlist[0].regions[j][0].name);
     
    170172      }
    171173      dvo_update_image_IDs (&IDmap2, &incatalog);
    172       merge_catalogs_old (&outsky[0].regions[i], &outcatalog, &incatalog, RADIUS, secfiltMap2);
     174      merge_catalogs_old (outlist[0].regions[i], &outcatalog, &incatalog, RADIUS, secfiltMap2);
    173175      dvo_catalog_unlock (&incatalog);
    174176      dvo_catalog_free (&incatalog);
     
    219221    in1DB.mode   = dvo_catalog_catmode (CATMODE);
    220222    in1DB.format = dvo_catalog_catformat (CATFORMAT);
    221     status       = dvo_image_lock (&in1DB, ImageCat, 3600.0, LCK_XCLD);  // shorter timeout?
     223    status       = dvo_image_lock (&in1DB, ImageCat, 3600.0, LCK_SOFT);  // shorter timeout?
    222224    if (!status) Shutdown ("ERROR: failure to lock image catalog %s", in1DB.filename);
    223225
    224226    // load the image table
    225     if (in1DB.dbstate == LCK_EMPTY) {
    226       Shutdown ("can't find input (1) image catalog %s", in1DB.filename);
    227     }
    228     if (!dvo_image_load (&in1DB, VERBOSE, TRUE)) {
    229       Shutdown ("can't read input (1) image catalog %s", in1DB.filename);
    230     }
    231 
     227    if (in1DB.dbstate != LCK_EMPTY) {
     228      if (!dvo_image_load (&in1DB, VERBOSE, TRUE)) {
     229        Shutdown ("can't read input (1) image catalog %s", in1DB.filename);
     230      }
     231    }
     232     
    232233    // convert database table to internal structure & add to output image db
     234    // if in1DB has no images, we will (later) insist that there are no image IDs to map
    233235    dvo_image_merge_dbs(IDmap1, &outDB, &in1DB);
    234236    dvo_image_unlock (&in1DB); // unlock input1
    235 
    236237
    237238    /*** load input2/Images.dat ***/
     
    239240    in2DB.mode   = dvo_catalog_catmode (CATMODE);
    240241    in2DB.format = dvo_catalog_catformat (CATFORMAT);
    241     status       = dvo_image_lock (&in2DB, ImageCat, 3600.0, LCK_XCLD);  // shorter timeout?
     242    status       = dvo_image_lock (&in2DB, ImageCat, 3600.0, LCK_SOFT);  // shorter timeout?
    242243    if (!status) Shutdown ("ERROR: failure to lock image catalog %s", in2DB.filename);
    243244
    244245    /* load the image table */
    245     if (in2DB.dbstate == LCK_EMPTY) {
    246       Shutdown ("can't find input (2) image catalog %s", in2DB.filename);
    247     }
    248     if (!dvo_image_load (&in2DB, VERBOSE, TRUE)) {
    249       Shutdown ("can't read input (2) image catalog %s", in2DB.filename);
     246    if (in2DB.dbstate != LCK_EMPTY) {
     247      if (!dvo_image_load (&in2DB, VERBOSE, TRUE)) {
     248        Shutdown ("can't read input (2) image catalog %s", in2DB.filename);
     249      }
    250250    }
    251251
    252252    // convert database table to internal structure & add to output image db
     253    // if in1DB has no images, we will (later) insist that there are no image IDs to map
    253254    dvo_image_merge_dbs(IDmap2, &outDB, &in2DB);
    254255    dvo_image_unlock (&in2DB); // unlock input2
Note: See TracChangeset for help on using the changeset viewer.