Changeset 30615
- Timestamp:
- Feb 13, 2011, 11:28:54 AM (15 years ago)
- Location:
- trunk/Ohana/src/dvomerge
- Files:
-
- 2 edited
- 1 copied
-
doc/usage.txt (copied) (copied from branches/eam_branches/ipp-20101205/Ohana/src/dvomerge/doc/usage.txt )
-
src/dvoverify.c (modified) (5 diffs)
-
src/help.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/dvomerge/src/dvoverify.c
r29938 r30615 9 9 10 10 int VerifyTableFile (char *filename); 11 int CheckCatalogIndexes (char *catdir, char *filename, SkyRegion *region); 11 12 12 13 # define DEBUG 0 14 15 int VERBOSE; 13 16 14 17 int main (int argc, char **argv) { … … 22 25 SkyRegion UserPatch; 23 26 // Catalog catalog; 27 28 VERBOSE = FALSE; 29 if ((N = get_argument (argc, argv, "-v"))) { 30 VERBOSE = TRUE; 31 remove_argument (N, &argc, argv); 32 } 24 33 25 34 // restrict to a portion of the sky … … 83 92 if (i % 1000 == 0) fprintf (stderr, "."); 84 93 85 sprintf (filename, "%s/%s.cpt", catdir, inlist[0].regions[i][0].name);86 if (!VerifyTableFile ( filename)) {94 // sprintf (filename, "%s/%s.cpt", catdir, inlist[0].regions[i][0].name); 95 if (!VerifyTableFile (inlist[0].filename[i])) { 87 96 Nbad ++; 88 97 } … … 95 104 sprintf (filename, "%s/%s.cpm", catdir, inlist[0].regions[i][0].name); 96 105 if (!VerifyTableFile (filename)) { 106 Nbad ++; 107 } 108 109 if (!CheckCatalogIndexes(catdir, inlist[0].filename[i], inlist[0].regions[i])){ 97 110 Nbad ++; 98 111 } … … 212 225 } 213 226 214 // gfits_scan(&cpmHeaderTBL, "NAXIS1", "%d", 1, &NbytesPerRow); 215 // gfits_scan(&cpmHeaderTBL, "NAXIS2", "%d", 1, &Nrows); 227 // CheckCatalogIndexes(catdir, inlist[0].regions[i][0].name); 228 229 int CheckCatalogIndexes (char *catdir, char *filename, SkyRegion *region) { 230 231 Catalog catalog; 232 int i, j, m, status; 233 234 status = TRUE; 235 236 // set the parameters which guide catalog open/load/create 237 catalog.filename = filename; 238 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 239 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 240 catalog.catflags = LOAD_AVES | LOAD_MEAS; 241 catalog.Nsecfilt = 0; 242 243 // an error exit status here is a significant error (disk I/O or file access) 244 if (!dvo_catalog_open (&catalog, region, VERBOSE, "r")) { 245 fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename); 246 return FALSE; 247 } 248 249 // Naves_disk == 0 implies an empty catalog file, skip empty catalogs 250 if (catalog.Naves_disk == 0) { 251 dvo_catalog_unlock (&catalog); 252 dvo_catalog_free (&catalog); 253 return TRUE; 254 } 255 256 // if the table is SORTED, then the following can be checked 257 // check the following: 258 // measure[j].averef -> average[averef] 259 // measure[j].objID = average[averef].objID 260 // measure[j].catID = average[averef].catID 261 // measure[j].measureOffset < Nmeasure 262 // \sum average[].Nmeasure = Nmeasure 263 264 // if the table is NOT SORTED, we have a subset of checks we can make 265 if (!catalog.sorted) { 266 fprintf (stderr, "!"); 267 dvo_catalog_unlock (&catalog); 268 dvo_catalog_free (&catalog); 269 return TRUE; 270 } 271 272 int NmeasureTotal = 0; 273 int measureOffsetOK = TRUE; 274 for (i = 0; i < catalog.Naverage; i++) { 275 NmeasureTotal += catalog.average[i].Nmeasure; 276 if (VERBOSE && !(NmeasureTotal <= catalog.Nmeasure)) { 277 fprintf (stderr, "NmeasureTotal > catalog.Nmeasure: %d %d %d\n", i, catalog.average[i].Nmeasure, (int) catalog.Nmeasure); 278 } 279 measureOffsetOK &= (catalog.average[i].measureOffset < catalog.Nmeasure); 280 if (VERBOSE && !(catalog.average[i].measureOffset < catalog.Nmeasure)) { 281 fprintf (stderr, "measureOffset >= catalog.Nmeasure: %d %d %d\n", i, catalog.average[i].measureOffset, (int) catalog.Nmeasure); 282 } 283 measureOffsetOK &= (catalog.average[i].measureOffset + catalog.average[i].Nmeasure <= catalog.Nmeasure); 284 if (VERBOSE && !(catalog.average[i].measureOffset + catalog.average[i].Nmeasure <= catalog.Nmeasure)) { 285 fprintf (stderr, "measureOffset + Nmeasure > catalog.Nmeasure : %d %d %d\n", i, catalog.average[i].Nmeasure, (int) catalog.Nmeasure); 286 } 287 } 288 289 if (!measureOffsetOK) { 290 fprintf (stderr, "ERROR: catalog %s has an invalid measureOffset\n", catalog.filename); 291 status = FALSE; 292 } 293 294 if (NmeasureTotal != catalog.Nmeasure) { 295 fprintf (stderr, "ERROR: catalog %s has an invalid Nmeasure\n", catalog.filename); 296 status = FALSE; 297 } 298 299 if (!status) { 300 dvo_catalog_unlock (&catalog); 301 dvo_catalog_free (&catalog); 302 return (status); 303 } 304 305 int objIDsOK = TRUE; 306 int catIDsOK = TRUE; 307 int averefOK = TRUE; 308 309 for (i = 0; i < catalog.Naverage; i++) { 310 m = catalog.average[i].measureOffset; 311 for (j = 0; j < catalog.average[i].Nmeasure; j++) { 312 objIDsOK &= (catalog.average[i].objID == catalog.measure[m+j].objID); 313 catIDsOK &= (catalog.average[i].catID == catalog.measure[m+j].catID); 314 averefOK &= (catalog.measure[m+j].averef == i); 315 } 316 } 317 318 if (!objIDsOK) { 319 fprintf (stderr, "ERROR: catalog %s has invalid obj IDs\n", catalog.filename); 320 status = FALSE; 321 } 322 if (!catIDsOK) { 323 fprintf (stderr, "ERROR: catalog %s has invalid cat IDs\n", catalog.filename); 324 status = FALSE; 325 } 326 if (!averefOK) { 327 fprintf (stderr, "ERROR: catalog %s has invalid averef values\n", catalog.filename); 328 status = FALSE; 329 } 330 331 // for (i = 0; i < catalog.Naverage; i++) { 332 // m = catalog.average[i].measureOffset; 333 // for (j = 0; i < catalog.Nmeasure; i++) { 334 // objIDsOK &= (catalog.average[i].objID == catalog.measure[m+j].objID); 335 // catIDsOK &= (catalog.average[i].catID == catalog.measure[m+j].catID); 336 // averefOK &= (catalog.measure[m+j].averef = i); 337 // } 338 // } 339 340 dvo_catalog_unlock (&catalog); 341 dvo_catalog_free (&catalog); 342 343 return status; 344 } 345 346 // gfits_scan(&cpmHeaderTBL, "NAXIS1", "%d", 1, &NbytesPerRow); 347 // gfits_scan(&cpmHeaderTBL, "NAXIS2", "%d", 1, &Nrows); 216 348 217 349 -
trunk/Ohana/src/dvomerge/src/help.c
r29938 r30615 37 37 fprintf (stderr, " dvomerge (input) into (output)\n"); 38 38 fprintf (stderr, " dvomerge (input) into (output) continue\n\n"); 39 fprintf (stderr, " dvomerge (input) into (output) from (list)\n\n"); 39 fprintf (stderr, " dvomerge (input) into (output) from (list)\n"); 40 fprintf (stderr, " dvomerge list implies 'continue' : list contains, eg, n1500/1688.00.cpt (one cpt per line)\n\n"); 40 41 fprintf (stderr, " merge DVO databases\n"); 41 42 fprintf (stderr, " optional flags:\n");
Note:
See TracChangeset
for help on using the changeset viewer.
