Changeset 5448 for trunk/Ohana/src/opihi/dvo/imdata.c
- Timestamp:
- Oct 27, 2005, 10:38:30 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/imdata.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/imdata.c
r5320 r5448 1 1 # include "dvo1.h" 2 void copy_region (GSCRegion *in, GSCRegion *out);3 2 4 3 int imdata (int argc, char **argv) { … … 13 12 Image *image; 14 13 Catalog catalog; 15 GSCRegion *region, *tregion; 14 SkyTable *sky; 15 SkyList *skylist, *skyset; 16 16 Vector *vec; 17 17 … … 80 80 GetTimeFormat (&TimeReference, &TimeFormat); 81 81 82 /* load sky from correct table */ 83 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE); 84 SkyTableSetFilenames (sky, CATDIR, "cpt"); 85 86 Nregions = 0; 87 NREGIONS = 10; 88 ALLOCATE (skylist, SkyList, 1); 89 ALLOCATE (skylist[0].regions, SkyRegions *, NREGIONS); 90 82 91 /* for each image of interest, find the appropriate region files */ 83 Nregion = 0;84 ALLOCATE (region, GSCRegion, 1);85 92 for (i = 0; i < Nsubset; i++) { 86 93 I = subset[i]; 94 87 95 if (!FindMosaicForImage (image, Nimage, I)) continue; 88 tregion = get_regions (&image[I], &Ntregion);89 REALLOCATE (region, GSCRegion, MAX (1, Nregion + Ntregion)); 90 for (j = 0; j < Ntregion; j++) {91 skip= FALSE;92 for (k = 0; (k < Nregion) && !skip; k++) {93 if (!strcmp (region[k].filename, tregion[j].filename)) skip = TRUE;94 } 95 if ( !skip) {96 copy_region (&tregion[j], ®ion[Nregion]);97 Nregion++;98 }99 } 100 free (tregion);96 skyset = SkyListByImage (table, -1, &image[I]); 97 98 for (j = 0; j < skyset[0].Nregions; j++) { 99 found = FALSE; 100 for (k = 0; (k < skylist[0].Nregion) && !found; k++) { 101 found = !strcmp (skylist[0].regions[k].name, skyset[0].regions[j].name); 102 } 103 if (found) continue; 104 skylist[0].regions[Nregions] = skyset[0].regions[j]; 105 Nregions ++; 106 CHECK_REALLOCATE (skylist[0].regions, SkyRegions *, NREGIONS, Nregions, 10); 107 } 108 SkyListFree (skyset); 101 109 } 102 110 free (subset); 103 for (i = 0; i < Nregion; i++) {104 fprintf (stderr, "try %s\n", region[i].filename);111 for (i = 0; i < skylist[0].Nregions; i++) { 112 fprintf (stderr, "try %s\n", skylist[0].regions[i][0].name); 105 113 } 106 114 … … 111 119 112 120 /* for each region file, extract the data of interest in the right time range */ 113 for (j = 0; j < Nregion; j++) {121 for (j = 0; j < skylist[0].Nregions; j++) { 114 122 115 123 /* get file name and open */ 116 strcpy (filename, region[j].filename); 117 catalog.filename = filename; 124 catalog.filename = skylist[0].regions[j][0].filename; 118 125 switch (lock_catalog (&catalog, LCK_SOFT)) { 119 126 case 2: … … 210 217 return (TRUE); 211 218 } 212 213 214 void copy_region (GSCRegion *in, GSCRegion *out) {215 216 out[0].RA[0] = in[0].RA[0];217 out[0].RA[1] = in[0].RA[1];218 out[0].DEC[0] = in[0].DEC[0];219 out[0].DEC[1] = in[0].DEC[1];220 strcpy (out[0].filename, in[0].filename);221 }222
Note:
See TracChangeset
for help on using the changeset viewer.
