Changeset 29001 for trunk/Ohana/src/dvomerge/src/dvomergeUpdate.c
- Timestamp:
- Aug 20, 2010, 12:05:07 PM (16 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/dvomerge/src/dvomergeUpdate.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo deleted
-
trunk/Ohana/src/dvomerge/src/dvomergeUpdate.c
r28857 r29001 6 6 off_t i, j, Ns, Ne; 7 7 SkyTable *outsky, *insky; 8 SkyList * inlist;8 SkyList *outlist, *inlist; 9 9 Catalog incatalog, outcatalog; 10 10 char filename[256], *input, *output; … … 70 70 SkyTableSetFilenames (insky, input, "cpt"); 71 71 72 // XXX apply this...generate the subset matching the user-selected region 73 inlist = SkyListByPatch (insky, -1, &UserPatch); 74 72 75 // generate an output table populated at the desired depth 73 76 outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); … … 79 82 // loop over the populatable output tables; check for data in input in the corresponding regions 80 83 81 Sky TablePopulatedRange (&Ns, &Ne, insky, 0);82 depth = in sky[0].regions[Ns].depth;84 SkyListPopulatedRange (&Ns, &Ne, inlist, 0); 85 depth = inlist[0].regions[Ns][0].depth; 83 86 84 // loop over the populat able output regions85 for (i = 0; i < outsky[0].Nregions; i++) {86 if (! outsky[0].regions[i].table) continue;87 if (VERBOSE) fprintf (stderr, " output: %s\n", outsky[0].regions[i].name);87 // loop over the populated input regions 88 for (i = 0; i < inlist[0].Nregions; i++) { 89 if (!inlist[0].regions[i][0].table) continue; 90 if (VERBOSE) fprintf (stderr, "input: %s\n", inlist[0].regions[i][0].name); 88 91 89 SetPhotcodeTable( outputPhotcodes);92 SetPhotcodeTable(inputPhotcodes); 90 93 // load / create output catalog (if catalog does not exist, it will be created) 91 LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w"); 94 LoadCatalog (&incatalog, &inlist[0].regions[i][0], inlist[0].filename[i], "r"); 95 // skip empty input catalogs 96 if (!incatalog.Naves_disk) { 97 dvo_catalog_unlock (&incatalog); 98 dvo_catalog_free (&incatalog); 99 continue; 100 } 92 101 93 102 // combine only tables at equal or larger depth … … 97 106 // compare to a slightly reduced footprint 98 107 float dPos = 2.0/3600.0; 99 inlist = SkyListByBounds (insky, depth, outsky[0].regions[i].Rmin + dPos, outsky[0].regions[i].Rmax - dPos, outsky[0].regions[i].Dmin + dPos, outsky[0].regions[i].Dmax - dPos);100 for (j = 0; j < inlist[0].Nregions; j++) {101 if (VERBOSE) fprintf (stderr, " input : %s\n", inlist[0].regions[j][0].name);108 outlist = SkyListByBounds (outsky, depth, inlist[0].regions[i][0].Rmin + dPos, inlist[0].regions[i][0].Rmax - dPos, inlist[0].regions[i][0].Dmin + dPos, inlist[0].regions[i][0].Dmax - dPos); 109 for (j = 0; j < outlist[0].Nregions; j++) { 110 if (VERBOSE) fprintf (stderr, "output : %s\n", outlist[0].regions[j][0].name); 102 111 103 112 // load input catalog 104 SetPhotcodeTable( inputPhotcodes);105 LoadCatalog (& incatalog, inlist[0].regions[j], inlist[0].filename[j], "r");113 SetPhotcodeTable(outputPhotcodes); 114 LoadCatalog (&outcatalog, outlist[0].regions[j], outlist[0].filename[j], "w"); 106 115 107 // skip empty input catalogs108 if (!incatalog.Naves_disk) {109 dvo_catalog_unlock (&incatalog);110 dvo_catalog_free (&incatalog);111 continue;112 }113 116 dvo_update_image_IDs (&IDmap, &incatalog); 114 merge_catalogs_old (&outsky[0].regions[i], &outcatalog, &incatalog, RADIUS, secfiltMap); 115 dvo_catalog_unlock (&incatalog); 116 dvo_catalog_free (&incatalog); 117 merge_catalogs_old (&outsky[0].regions[j], &outcatalog, &incatalog, RADIUS, secfiltMap); 117 118 118 fprintf (stderr, "merged %s into %s\n", outsky[0].regions[i].name, inlist[0].regions[j][0].name); 119 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 120 121 // if we receive a signal which would cause us to exit, wait until the full catalog is written 122 SetProtect (TRUE); 123 dvo_catalog_save (&outcatalog, VERBOSE); 124 SetProtect (FALSE); 125 126 dvo_catalog_unlock (&outcatalog); 127 dvo_catalog_free (&outcatalog); 128 129 fprintf (stderr, "merged %s into %s\n", inlist[0].regions[i][0].name, outlist[0].regions[j][0].name); 119 130 } 120 SkyListFree ( inlist);131 SkyListFree (outlist); 121 132 122 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 123 dvo_catalog_save (&outcatalog, VERBOSE); 124 dvo_catalog_unlock (&outcatalog); 125 dvo_catalog_free (&outcatalog); 133 dvo_catalog_unlock (&incatalog); 134 dvo_catalog_free (&incatalog); 126 135 } 127 136 … … 153 162 // load the image table 154 163 if (inDB.dbstate == LCK_EMPTY) { 155 Shutdown ("can't find input image catalog %s", inDB.filename); 164 // Shutdown ("can't find input image catalog %s", inDB.filename); 165 IDmap->Nmap = 0; 166 return TRUE; 156 167 } 157 168 if (!dvo_image_load (&inDB, VERBOSE, TRUE)) {
Note:
See TracChangeset
for help on using the changeset viewer.
