IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28330


Ignore:
Timestamp:
Jun 15, 2010, 9:47:00 AM (16 years ago)
Author:
eugene
Message:

allow target db to not exist

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/dvomerge/src/dvomergeUpdate.c

    r27583 r28330  
    1616  output = argv[3];
    1717
    18   // the first input defines the photcode table & db layout
    19   sprintf (filename, "%s/Photcodes.dat", input);
     18  // since we are merging the input db into the output db, the output defines the photcode
     19  // table & db layout but, this requires the output to exist.  if it does not, instead use the
     20  // input.
     21  sprintf (filename, "%s/Photcodes.dat", output);
    2022  if (!LoadPhotcodes (filename, NULL, FALSE)) {
    21     fprintf (stderr, "error loading photcode table %s\n", filename);
    22     exit (1);
     23    sprintf (filename, "%s/Photcodes.dat", input);
     24    if (!LoadPhotcodes (filename, NULL, FALSE)) {
     25      fprintf (stderr, "error loading photcode table: tried %s/Photcodes.dat and %s/Photcodes.dat\n", output, input);
     26      exit (1);
     27    }
    2328  }
    2429
     
    2732  // load the sky table for the existing database
    2833  insky = SkyTableLoadOptimal (input, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE);
     34  if (!insky) {
     35      Shutdown ("can't read SkyTable for %s", input);
     36  }
    2937  SkyTableSetFilenames (insky, input, "cpt");
    3038
    3139  // generate an output table populated at the desired depth
    32   outsky = SkyTableLoadOptimal (output, NULL, NULL, TRUE, SKY_DEPTH, VERBOSE);
     40  outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
     41  if (!outsky) {
     42      Shutdown ("can't read or create SkyTable for %s", output);
     43  }
    3344  SkyTableSetFilenames (outsky, output, "cpt");
    3445
     
    4354    if (VERBOSE) fprintf (stderr, "output: %s\n", outsky[0].regions[i].name);
    4455
    45     // load / create output catalog
    46     LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "a");
     56    // load / create output catalog (if catalog does not exist, it will be created)
     57    LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w");
    4758
    4859    // combine only tables at equal or larger depth
     
    102113  // load the image table
    103114  if (inDB.dbstate == LCK_EMPTY) {
    104     Shutdown ("can't find input (1) image catalog %s", inDB.filename);
     115    Shutdown ("can't find input image catalog %s", inDB.filename);
    105116  }
    106117  if (!dvo_image_load (&inDB, VERBOSE, TRUE)) {
    107     Shutdown ("can't read input (1) image catalog %s", inDB.filename);
     118    Shutdown ("can't read input image catalog %s", inDB.filename);
    108119  }
    109120
     
    117128  /* load the image table */
    118129  if (outDB.dbstate == LCK_EMPTY) {
    119     Shutdown ("can't find input (2) image catalog %s", outDB.filename);
    120   }
    121   if (!dvo_image_load (&outDB, VERBOSE, TRUE)) {
    122     Shutdown ("can't read input (2) image catalog %s", outDB.filename);
     130    dvo_image_create (&outDB, GetZeroPoint());
     131  } else {
     132    if (!dvo_image_load (&outDB, VERBOSE, TRUE)) {
     133      Shutdown ("can't read output image catalog %s", outDB.filename);
     134    }
    123135  }
    124136
Note: See TracChangeset for help on using the changeset viewer.