IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6993


Ignore:
Timestamp:
Apr 26, 2006, 1:01:48 PM (20 years ago)
Author:
eugene
Message:

added resort option

Location:
trunk/Ohana/src/addstar
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/Makefile

    r6763 r6993  
    5656$(SRC)/parse_time.$(ARCH).o \
    5757$(SRC)/replace_match.$(ARCH).o \
     58$(SRC)/resort_catalog.$(ARCH).o \
    5859$(SRC)/SetSignals.$(ARCH).o \
    5960$(SRC)/sort_lists.$(ARCH).o \
  • trunk/Ohana/src/addstar/include/addstar.h

    r6763 r6993  
    3333typedef struct sockaddr_in SockAddress;
    3434
    35 enum {M_IMAGE, M_REFLIST, M_REFCAT, M_FAKEIMAGE};
     35enum {M_IMAGE, M_REFLIST, M_REFCAT, M_FAKEIMAGE, M_RESORT};
    3636
    3737/* global which define database info / data sources (KEEP) */
     
    151151Stars     *rd_gsc                 PROTO((char *filename, int *nstars));
    152152int        replace_match          PROTO((Average *average, Measure *measure, Stars *star));
     153void       resort_catalog         PROTO((Catalog *catalog));
    153154Stars     *rfits                  PROTO((FILE *f, unsigned int *nstars));
    154155Stars     *rtext                  PROTO((FILE *f, unsigned int *nstars));
  • trunk/Ohana/src/addstar/src/addstar.c

    r6763 r6993  
    5151      skylist = SkyListForStars (sky, -1, stars, Nstars);
    5252      break;
     53    case M_RESORT:
    5354    case M_REFCAT:
    5455      skylist = SkyListByPatch (sky, -1, &UserPatch);
     
    124125        if (Nsubset) free (subset);
    125126        break;
     127      case M_RESORT:
     128        if (options.nosort == 3) catalog.sorted = FALSE;
     129        resort_catalog (&catalog);
     130        Nsubset = 1;
     131        break;
    126132    }
    127133
  • trunk/Ohana/src/addstar/src/args.c

    r6763 r6993  
    44AddstarClientOptions args (int argc, char **argv, AddstarClientOptions options) {
    55 
    6   int N;
     6  int i, N;
    77  int QUALITY_AIRMASS;
    88
     
    3333    remove_argument (N, &argc, argv);
    3434    FAKE_THETA = atof (argv[N]);
     35    remove_argument (N, &argc, argv);
     36  }
     37  if ((N = get_argument (argc, argv, "-resort"))) {
     38    options.mode = M_RESORT;
    3539    remove_argument (N, &argc, argv);
    3640  }
     
    5256    UserPatch.Dmax = atof (argv[N]);
    5357    remove_argument (N, &argc, argv);
    54   }
     58  } else {
     59      if (options.mode == M_IMAGE) goto allow;
     60      if (options.mode == M_FAKEIMAGE) goto allow;
     61      if (options.mode == M_REFLIST) goto allow;
     62      if (options.mode == M_REFCAT) {
     63          fprintf (stderr, "you have requested uploading from a catalog to the entire sky in one pass\n");
     64      }
     65      if (options.mode == M_RESORT) {
     66          fprintf (stderr, "you have requested resorting the entire sky in one pass\n");
     67      }
     68      fprintf (stderr, "this could be a time consuming operation.  type Ctrl-C within 5 seconds to cancel\n");
     69      for (i = 5; i > 0; i--) {
     70          fprintf (stderr, "%d.. ", i);
     71          usleep (1000000);
     72      }
     73      fprintf (stderr, "\n");
     74  }
     75allow:
    5576  /* override any header PHOTCODE values */
    5677  options.photcode = 0;
     
    147168    remove_argument (N, &argc, argv);
    148169  }
     170  if ((N = get_argument (argc, argv, "-force-sort"))) {
     171    options.nosort = 3;  // temporary mode to mean 'force-sort'
     172    remove_argument (N, &argc, argv);
     173  }
    149174
    150175  /* only add image potion to image table */
     
    242267  }
    243268
     269  if ((options.mode == M_RESORT) && (argc == 1)) return (options);
     270  if (argc == 2) return (options);
     271
    244272  if ((options.mode == M_REFLIST) && (options.photcode == 0)) {
    245273    fprintf (stderr, "photcode must be specified for -ref\n");
     
    247275  }
    248276
    249   if (argc != 2) {
    250     fprintf (stderr, "USAGE: addstar (filename)\n");
    251     fprintf (stderr, "USAGE: addstar -cat (catalog)\n");
    252     fprintf (stderr, "USAGE: addstar -ref (filename)\n");
    253     fprintf (stderr, "USAGE: addstar -fakeimage (ra) (dec) (theta) (name)\n");
    254     exit (2);
    255   }
    256   return (options);
     277  fprintf (stderr, "USAGE: addstar (filename)\n");
     278  fprintf (stderr, "USAGE: addstar -cat (catalog)\n");
     279  fprintf (stderr, "USAGE: addstar -ref (filename)\n");
     280  fprintf (stderr, "USAGE: addstar -fakeimage (ra) (dec) (theta) (name)\n");
     281  fprintf (stderr, "USAGE: addstar -resort (SkyRegion)\n");
     282  exit (2);
    257283}
    258284
     
    266292  fprintf (stderr, "  addstar -cat (catalog)");
    267293  fprintf (stderr, "     add data from catalog (USNO/2MASS/GSC) to database\n\n");
     294  fprintf (stderr, "  addstar -resort (SkyRegion)");
     295  fprintf (stderr, "     perform measure sorting for the specified catalog\n\n");
    268296
    269297  fprintf (stderr, "  optional flags:\n");
Note: See TracChangeset for help on using the changeset viewer.