- Timestamp:
- Aug 20, 2010, 11:15:36 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/Ohana/src/dvomerge/src/dvomergeCreate.c
r27583 r28993 10 10 SkyList *inlist; 11 11 Catalog incatalog, outcatalog; 12 char filename[256], *input1, *input2, *output; 12 char filename[256]; 13 char filename1[256]; 14 char *codesFilename; 15 char *input1, *input2, *output; 13 16 IDmapType IDmap1, IDmap2; 14 17 … … 22 25 dvomergeImagesCreate (&IDmap1, input1, &IDmap2, input2, output); 23 26 24 // the first input defines the photcode table & db layout 25 sprintf (filename, "%s/Photcodes.dat", input1); 27 PhotCodeData *input1Photcodes = NULL; 28 PhotCodeData *input2Photcodes = NULL; 29 PhotCodeData *outputPhotcodes = NULL; 30 int *secfiltMap1 = NULL; 31 int *secfiltMap2 = NULL; 32 33 // Read the input1 photcodes 34 SetPhotcodeTable(NULL); 35 sprintf (filename1, "%s/Photcodes.dat", input1); 36 if (!LoadPhotcodes (filename1, NULL, FALSE)) { 37 fprintf (stderr, "error loading photcode table %s\n", filename1); 38 exit (1); 39 } 40 input1Photcodes = GetPhotcodeTable(); 41 42 // Read the input2 photcodes 43 SetPhotcodeTable(NULL); 44 sprintf (filename, "%s/Photcodes.dat", input2); 26 45 if (!LoadPhotcodes (filename, NULL, FALSE)) { 27 46 fprintf (stderr, "error loading photcode table %s\n", filename); 28 47 exit (1); 29 48 } 30 // save the photcodes in the output catdir 49 input2Photcodes = GetPhotcodeTable(); 50 51 if (ALTERNATE_PHOTCODE_FILE) { 52 SetPhotcodeTable(NULL); 53 // First attempt to read file as fits table ... 54 if (!LoadPhotcodes(ALTERNATE_PHOTCODE_FILE, NULL, FALSE)) { 55 // and if that fails try it as a text file 56 if (!LoadPhotcodesText(ALTERNATE_PHOTCODE_FILE)) { 57 fprintf (stderr, "failed to read photcode file %s\n", ALTERNATE_PHOTCODE_FILE); 58 exit (1); 59 } 60 } 61 outputPhotcodes = GetPhotcodeTable(); 62 63 secfiltMap1 = GetSecFiltMap(outputPhotcodes, input1Photcodes); 64 if (!secfiltMap1) { 65 fprintf (stderr, "failed to map %s secfilt photcodes to alternate photcodes table %s\n", input1, 66 ALTERNATE_PHOTCODE_FILE); 67 exit (1); 68 } 69 70 codesFilename = ALTERNATE_PHOTCODE_FILE; 71 72 } else { 73 // Use the first input file's photcodes 74 outputPhotcodes = input1Photcodes; 75 codesFilename = filename1; 76 // secfitMap1 can remain NULL since input1 defines the set of codes 77 } 78 79 secfiltMap2 = GetSecFiltMap(outputPhotcodes, input2Photcodes); 80 if (!secfiltMap2) { 81 fprintf (stderr, "falied to map %s secfilt photcodes to output photcodes table %s\n", input2, 82 codesFilename); 83 exit (1); 84 } 85 86 // save the output photcodes in the output catdir 87 SetPhotcodeTable(outputPhotcodes); 31 88 sprintf (filename, "%s/Photcodes.dat", output); 32 89 if (!check_file_access (filename, TRUE, TRUE, VERBOSE)) { … … 64 121 if (VERBOSE) fprintf (stderr, "output: %s\n", outsky[0].regions[i].name); 65 122 123 if (outputPhotcodes) { 124 SetPhotcodeTable(outputPhotcodes); 125 } 66 126 // load / create output catalog 67 127 LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w"); 68 128 129 if (input1Photcodes) { 130 SetPhotcodeTable(input1Photcodes); 131 } 69 132 // combine only tables at equal or larger depth 70 133 … … 84 147 } 85 148 dvo_update_image_IDs (&IDmap1, &incatalog); 86 merge_catalogs_new (&outsky[0].regions[i], &outcatalog, &incatalog );149 merge_catalogs_new (&outsky[0].regions[i], &outcatalog, &incatalog, secfiltMap1); 87 150 dvo_catalog_unlock (&incatalog); 88 151 dvo_catalog_free (&incatalog); 89 152 } 90 153 SkyListFree (inlist); 154 155 if (input2Photcodes) { 156 SetPhotcodeTable(input2Photcodes); 157 } 91 158 92 159 // load in all of the tables from input2 for this region … … 95 162 if (VERBOSE) fprintf (stderr, "input 2: %s\n", inlist[0].regions[j][0].name); 96 163 97 // load input catalog ( 1)164 // load input catalog (2) 98 165 LoadCatalog (&incatalog, inlist[0].regions[j], inlist[0].filename[j], "r"); 99 166 … … 105 172 } 106 173 dvo_update_image_IDs (&IDmap2, &incatalog); 107 merge_catalogs_old (&outsky[0].regions[i], &outcatalog, &incatalog, RADIUS );174 merge_catalogs_old (&outsky[0].regions[i], &outcatalog, &incatalog, RADIUS, secfiltMap2); 108 175 dvo_catalog_unlock (&incatalog); 109 176 dvo_catalog_free (&incatalog);
Note:
See TracChangeset
for help on using the changeset viewer.
