IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2005, 7:10:17 PM (21 years ago)
Author:
eugene
Message:

working on SkyRegion conversion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/mextract.c

    r5320 r5451  
    44 
    55  int i, j, k, m, N, N1, NPTS;
    6   int param, mode, Nregions, Nsec;
    7   char filename[128], catdir[256], *RegionName, *RegionList, *p;
     6  int param, mode, Nsec;
     7  char *RegionName, *RegionList, *p;
    88  double *M1;
    99
    1010  PhotCode *code;
    1111  Catalog catalog;
    12   RegionFile *regions;
     12  SkyList *skylist;
    1313  Vector *vec;
    1414
    1515  /* defaults */
    16   regions = NULL;
    1716  catalog.average = (Average *) NULL;
    1817  catalog.secfilt = (SecFilt *) NULL;
     
    2625  if (!InitPhotcodes ()) goto escape;
    2726  Nsec = GetPhotcodeNsecfilt ();
    28 
    29   /* find CATDIR in config system */
    30   if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;
    3127
    3228  /* interpret command-line options */
     
    5147
    5248  /* load region corresponding to selection above */
    53   if ((regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;
    54   if (!SetImageSelection (param)) goto escape;
     49  if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape;
     50  if (!SetImageSelection (param, ((RegionName == NULL) && (RegionList == NULL)))) goto escape;
    5551
    5652  /* create storage vector */
     
    5955  if ((vec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto escape;
    6056
    61   for (i = 0; i < Nregions; i++) {
    62     /* lock, load, unlock catalog */
    63     sprintf (filename, "%s/%s", catdir, regions[i].name);
    64     catalog.filename = filename;
     57  for (i = 0; i < skylist[0].Nregions; i++) {
     58    catalog.filename = (char *) skylist[0].regions[i][0].filename;
    6559    switch (lock_catalog (&catalog, LCK_SOFT)) {
    6660    case 2:
     
    9791  REALLOCATE (vec[0].elements, float, MAX(1,N));
    9892
    99   if (regions != NULL) free (regions);
    10093  FreeImageSelection ();
     94  SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
     95  if (RegionName != NULL) free (RegionName);
     96  if (RegionList != NULL) free (RegionList);
    10197  return (TRUE);
    10298
     
    108104escape:
    109105  FreeImageSelection ();
    110   if (regions != NULL) free (regions);
     106  SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
    111107  if (catalog.average != NULL) free (catalog.average);
    112108  if (catalog.secfilt != NULL) free (catalog.secfilt);
Note: See TracChangeset for help on using the changeset viewer.