IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36188


Ignore:
Timestamp:
Oct 9, 2013, 10:36:43 AM (13 years ago)
Author:
eugene
Message:

added -time-start, -time-end and -photcode-start, -photcode-end to dvopsps

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

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/dvopsps/include/dvopsps.h

    r35578 r36188  
    33# include <signal.h>
    44# include "mysql.h"
     5# include "limits.h"
    56
    67# define DVO_MAX_PATH 1024
     
    3839int          PARALLEL_MANUAL;
    3940int          PARALLEL_SERIAL;
     41
     42char        *TIME_START;
     43char        *TIME_END;
     44
     45int          PHOTCODE_START;
     46int          PHOTCODE_END;
    4047
    4148char        *SINGLE_CPT;
  • trunk/Ohana/src/dvopsps/src/initialize_dvopsps.c

    r35206 r36188  
    22
    33void usage_dvopsps () {
    4   fprintf (stderr, "USAGE: dvopsps (mode) [dbinfo] (mode) [options]\n");
     4  fprintf (stderr, "USAGE: dvopsps (mode) [dbinfo] [options]\n");
    55  fprintf (stderr, "    mysql database info is supplied with these:\n");
    66  fprintf (stderr, "    -dbhost : database host machine\n");
     
    1111  fprintf (stderr, "    -v : verbose mode\n");
    1212  fprintf (stderr, "    -region Rmin Rmax Dmin Dmax\n");
     13  fprintf (stderr, "    -cpt n0000/0000.00 : limit to the named cpt file\n");
    1314  fprintf (stderr, "    -parallel : run in parallel mode\n");
     15  fprintf (stderr, "    -insert-remote : in parallel mode, the client sends the data to the dbhost\n");
     16  fprintf (stderr, "    -time-start YYYY/MM/DD,hh:mm:ss : limit detections to >= this time\n");
     17  fprintf (stderr, "    -time-end   YYYY/MM/DD,hh:mm:ss : limit detections to <  this time\n");
     18
     19  fprintf (stderr, "    -photcode-start NN : limit detections to >= this photcode number\n");
     20  fprintf (stderr, "    -photcode-end   NN : limit detections to <  this photcode number\n");
     21  fprintf (stderr, "\n");
     22
     23  fprintf (stderr, " (mode) is one of detections, objects, skytable\n");
     24
     25  fprintf (stderr, "\n");
    1426  fprintf (stderr, "    -h     : this help list\n");
    1527  fprintf (stderr, "    -help  : this help list\n");
    1628  fprintf (stderr, "    --h    : this help list\n");
    1729  fprintf (stderr, "    --help : this help list\n");
     30
    1831  fprintf (stderr, "    Note that the dvo db can be specified by -D CATDIR (directory)\n");
    1932  exit (2);
     
    110123  if ((N = get_argument (argc, argv, "-insert-remote"))) {
    111124    SAVE_REMOTE = FALSE;
     125    remove_argument (N, &argc, argv);
     126  }
     127
     128  TIME_START = NULL;
     129  if ((N = get_argument (argc, argv, "-time-start"))) {
     130    remove_argument (N, &argc, argv);
     131    TIME_START = strcreate(argv[N]);
     132    remove_argument (N, &argc, argv);
     133    time_t TIME_START_SEC;
     134    if (!ohana_str_to_time (TIME_START, &TIME_START_SEC)) {
     135      fprintf (stderr, "error with starting time given by -time-start: %s\n", TIME_START);
     136      exit (2);
     137    }
     138  }
     139
     140  TIME_END = NULL;
     141  if ((N = get_argument (argc, argv, "-time-end"))) {
     142    remove_argument (N, &argc, argv);
     143    TIME_END = strcreate(argv[N]);
     144    remove_argument (N, &argc, argv);
     145    time_t TIME_END_SEC;
     146    if (!ohana_str_to_time (TIME_END, &TIME_END_SEC)) {
     147      fprintf (stderr, "error with starting time given by -time-end: %s\n", TIME_END);
     148      exit (2);
     149    }
     150  }
     151
     152  PHOTCODE_START = 0;
     153  if ((N = get_argument (argc, argv, "-photcode-start"))) {
     154    remove_argument (N, &argc, argv);
     155    PHOTCODE_START = atoi(argv[N]);
     156    remove_argument (N, &argc, argv);
     157  }
     158
     159  PHOTCODE_END = INT_MAX;
     160  if ((N = get_argument (argc, argv, "-photcode-end"))) {
     161    remove_argument (N, &argc, argv);
     162    PHOTCODE_END = atoi(argv[N]);
    112163    remove_argument (N, &argc, argv);
    113164  }
     
    260311  }
    261312
     313  TIME_START = NULL;
     314  if ((N = get_argument (argc, argv, "-time-start"))) {
     315    remove_argument (N, &argc, argv);
     316    TIME_START = strcreate(argv[N]);
     317    remove_argument (N, &argc, argv);
     318    time_t TIME_START_SEC;
     319    if (!ohana_str_to_time (TIME_START, &TIME_START_SEC)) {
     320      fprintf (stderr, "error with starting time given by -time-start: %s\n", TIME_START);
     321      exit (2);
     322    }
     323  }
     324
     325  TIME_END = NULL;
     326  if ((N = get_argument (argc, argv, "-time-end"))) {
     327    remove_argument (N, &argc, argv);
     328    TIME_END = strcreate(argv[N]);
     329    remove_argument (N, &argc, argv);
     330    time_t TIME_END_SEC;
     331    if (!ohana_str_to_time (TIME_END, &TIME_END_SEC)) {
     332      fprintf (stderr, "error with starting time given by -time-end: %s\n", TIME_END);
     333      exit (2);
     334    }
     335  }
     336
     337  PHOTCODE_START = 0;
     338  if ((N = get_argument (argc, argv, "-photcode-start"))) {
     339    remove_argument (N, &argc, argv);
     340    PHOTCODE_START = atoi(argv[N]);
     341    remove_argument (N, &argc, argv);
     342  }
     343
     344  PHOTCODE_END = INT_MAX;
     345  if ((N = get_argument (argc, argv, "-photcode-end"))) {
     346    remove_argument (N, &argc, argv);
     347    PHOTCODE_END = atoi(argv[N]);
     348    remove_argument (N, &argc, argv);
     349  }
     350
    262351  VERBOSE = FALSE;
    263352  if ((N = get_argument (argc, argv, "-v"))) {
  • trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps.c

    r35804 r36188  
    152152    if (VERBOSE)     { snprintf (tmpline, 1024, "%s -v",       command);                          strcpy (command, tmpline); }
    153153    if (SAVE_REMOTE) { snprintf (tmpline, 1024, "%s -save %s", command, table->hosts[i].results); strcpy (command, tmpline); }
     154
     155    // some filters -- these are the detections we skip
     156    if (TIME_START) { snprintf (tmpline, 1024, "%s -time-start %s", command, TIME_START); strcpy (command, tmpline); }
     157    if (TIME_END)   { snprintf (tmpline, 1024, "%s -time-end %s",   command, TIME_END);   strcpy (command, tmpline); }
     158   
     159    if (PHOTCODE_START > 0)      { snprintf (tmpline, 1024, "%s -photcode-start %d", command, PHOTCODE_START); strcpy (command, tmpline); }
     160    if (PHOTCODE_END <= INT_MAX) { snprintf (tmpline, 1024, "%s -photcode-end %d",   command, PHOTCODE_END);   strcpy (command, tmpline); }
    154161
    155162    fprintf (stderr, "command: %s\n", command);
  • trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c

    r36097 r36188  
    2929  }
    3030
     31  time_t TIME_START_SEC = 0;
     32  time_t TIME_END_SEC   = 0;
     33  if (TIME_START) ohana_str_to_time (TIME_START, &TIME_START_SEC); // we validate this in the args.c
     34  if (TIME_END)   ohana_str_to_time (TIME_END,   &TIME_END_SEC);   // we validate this in the args.c
     35
    3136  for (i = 0; i < catalog[0].Naverage; i++) {
    3237
     
    4045      Average *average = &catalog->average[i];
    4146      Measure *measure = &catalog->measure[m + j];
     47
     48      // some filters -- these are the detections we skip
     49      if (TIME_START && (measure->t < TIME_START_SEC)) continue;
     50      if (TIME_END   && (measure->t >=  TIME_END_SEC)) continue;
     51
     52      if (measure->photcode < PHOTCODE_START) continue;
     53      if (measure->photcode >=  PHOTCODE_END) continue;
     54
    4255      PhotCode *code = GetPhotcodebyCode(measure->photcode);
    4356
     
    87100}
    88101
     102time_t TIME_START_SEC = 0;
     103time_t TIME_END_SEC   = INT_MAX;
     104
    89105int insert_detections_dvopsps_catalog (Catalog *catalog, MYSQL *mysql) {
    90106
     
    108124  int status = TRUE;
    109125
     126  if (TIME_START) ohana_str_to_time (TIME_START, &TIME_START_SEC); // we validate this in the args.c
     127  if (TIME_END)   ohana_str_to_time (TIME_END,   &TIME_END_SEC);   // we validate this in the args.c
     128
    110129  // NOTE for testing, just do a few objects
    111130  if (!mysql) {
     
    121140    for (j = 0; j < average[i].Nmeasure; j++) {
    122141
     142      off_t Nmeas = m + j;
     143
     144      // some filters -- these are the detections we skip (not an error, just skipped)
     145      if (TIME_START && (measure[Nmeas].t < TIME_START_SEC)) continue;
     146      if (TIME_END   && (measure[Nmeas].t >=  TIME_END_SEC)) continue;
     147 
     148      if (measure[Nmeas].photcode < PHOTCODE_START) continue;
     149      if (measure[Nmeas].photcode >=  PHOTCODE_END) continue;
     150
    123151      // XXX check return status
    124       if (!insert_detections_mysql_value (&buffer, &average[i], &measure[m+j])) {
     152      if (!insert_detections_mysql_value (&buffer, &average[i], &measure[Nmeas])) {
    125153        fprintf (stderr, "failure to insert detections in mysql\n");
    126154        status = FALSE;
Note: See TracChangeset for help on using the changeset viewer.