IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2015, 4:49:06 PM (11 years ago)
Author:
eugene
Message:

extensive work on relphot, relastro, uniphot, dvomerge aiming to the construction and calibration of PV3

Location:
trunk/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c

    r38470 r38986  
    177177      LoadCatalog (&outcatalog, outlist[0].regions[j], outcatalog.filename, "w", NsecfiltOutput);
    178178
    179       // if no catalog already exists, use the input catalog to define the format or the specified format
    180179      if (UPDATE_CATFORMAT) {
    181180        outcatalog.catformat = dvo_catalog_catformat (UPDATE_CATFORMAT);
    182181      } else {
    183         outcatalog.catformat = incatalog.catformat;
    184       }
     182        // IF no catalog already exists, use the input catalog to define the format
     183        if (outcatalog.Naverage_disk == 0) {
     184          outcatalog.catformat = incatalog.catformat;
     185        }
     186      }
     187
    185188      if (UPDATE_CATCOMPRESS) {
    186189        outcatalog.catcompress = dvo_catalog_catcompress (UPDATE_CATCOMPRESS);
    187190      } else {
    188         outcatalog.catcompress = incatalog.catcompress;
     191        // IF no catalog already exists, use the input catalog to define the compression
     192        if (outcatalog.Naverage_disk == 0) {
     193          outcatalog.catcompress = incatalog.catcompress;
     194        }
     195      }
     196
     197      if (REPAIR_BY_OBJID) {
     198        // For gpc1 / PV3, I broke some catalogs with dvomerge -replace: the last object can
     199        // contaminate the first set of new measurements
     200        repair_catalog_by_objID (&outcatalog);
    189201      }
    190202
     
    195207      }
    196208
    197       if (!dvo_catalog_backup (&outcatalog, TRUE)) {
     209      if (!dvo_catalog_backup (&outcatalog, "~", TRUE)) {
    198210        fprintf (stderr, "ERROR: failed to make backup for catalog %s\n", outlist[0].filename[j]);
    199211        exit (1);
     
    202214      // if we receive a signal which would cause us to exit, wait until the full catalog is written
    203215      SetProtect (TRUE);
    204       if (!dvo_catalog_save (&outcatalog, VERBOSE)) {
    205         fprintf (stderr, "ERROR: failed to save catalog %s\n", outlist[0].filename[j]);
    206         exit (1);
    207       }
     216      if (!dvo_catalog_save (&outcatalog, VERBOSE)) { fprintf (stderr, "ERROR: failed to save catalog %s\n", outcatalog.filename); exit (1); }
     217      if (!dvo_catalog_unlock (&outcatalog)) { fprintf (stderr, "ERROR: failed to unlock catalog %s\n", outcatalog.filename); exit (1); }
    208218      SetProtect (FALSE);
    209219
    210       if (!dvo_catalog_unlock (&outcatalog)) {
    211         fprintf (stderr, "ERROR: failed to unlock catalog %s\n", outlist[0].filename[j]);
    212         exit (1);
    213       }
    214 
    215       if (!dvo_catalog_unlink_backup (&outcatalog, TRUE)) {
     220      if (!dvo_catalog_unlink_backup (&outcatalog, "~", TRUE)) {
    216221        fprintf (stderr, "WARNING: failed to remove backup for catalog %s\n", outlist[0].filename[j]);
    217222      }
     
    282287
    283288    // options / arguments that can affect relastro_client -update-objects:
    284     char command[DVO_MAX_PATH];
    285     snprintf (command, DVO_MAX_PATH, "dvomerge_client %s into %s -hostID %d -hostdir %s -region %f %f %f %f -D ADDSTAR_RADIUS %f",
    286               absinput, absoutput, group->hosts[i][0].hostID, group->hosts[i][0].pathname,
    287               UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, RADIUS
    288       );
    289 
    290     char tmpline[DVO_MAX_PATH];
    291     if (VERBOSE)             { snprintf (tmpline, DVO_MAX_PATH, "%s -v",                command); strcpy (command, tmpline); }
    292     if (VERIFY)              { snprintf (tmpline, DVO_MAX_PATH, "%s -verify",           command); strcpy (command, tmpline); }
    293     if (VERIFY_CATALOG_ONLY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify-catalogs",  command); strcpy (command, tmpline); }
    294     if (REPLACE_BY_PHOTCODE) { snprintf (tmpline, DVO_MAX_PATH, "%s -replace",          command); strcpy (command, tmpline); }
    295     if (REPLACE_TYCHO)       { snprintf (tmpline, DVO_MAX_PATH, "%s -replace-tycho",    command); strcpy (command, tmpline); }
    296     if (PARALLEL_INPUT)      { snprintf (tmpline, DVO_MAX_PATH, "%s -parallel-input",   command); strcpy (command, tmpline); }
    297     if (FORCE_MERGE)         { snprintf (tmpline, DVO_MAX_PATH, "%s -force-merge",      command); strcpy (command, tmpline); }
    298     if (MATCHED_TABLES)      { snprintf (tmpline, DVO_MAX_PATH, "%s -matched-tables",   command); strcpy (command, tmpline); }
    299     if (UPDATE_CATFORMAT)    { snprintf (tmpline, DVO_MAX_PATH, "%s -update-catformat %s", command, UPDATE_CATFORMAT); strcpy (command, tmpline); }
     289    char *command = NULL;
     290    strextend (&command, "dvomerge_client %s into %s -hostID %d -hostdir %s -region %f %f %f %f -D ADDSTAR_RADIUS %f",
     291               absinput, absoutput, group->hosts[i][0].hostID, group->hosts[i][0].pathname,
     292               UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, RADIUS);
     293
     294    if (VERBOSE)             { strextend (&command, "-v"); }
     295    if (VERIFY)              { strextend (&command, "-verify"); }
     296    if (VERIFY_CATALOG_ONLY) { strextend (&command, "-verify-catalogs"); }
     297    if (REPLACE_BY_PHOTCODE) { strextend (&command, "-replace"); }
     298    if (REPLACE_TYCHO)       { strextend (&command, "-replace-tycho"); }
     299    if (PARALLEL_INPUT)      { strextend (&command, "-parallel-input"); }
     300    if (FORCE_MERGE)         { strextend (&command, "-force-merge"); }
     301    if (MATCHED_TABLES)      { strextend (&command, "-matched-tables"); }
     302    if (UPDATE_CATFORMAT)    { strextend (&command, "-update-catformat %s", UPDATE_CATFORMAT); }
     303    if (UPDATE_CATCOMPRESS)  { strextend (&command, "-update-catcompress %s", UPDATE_CATCOMPRESS); }
     304    if (REPAIR_BY_OBJID)     { strextend (&command, "-repair-by-objid"); }
    300305
    301306    // add some config variables:
    302     snprintf (tmpline, DVO_MAX_PATH, "%s -D CATMODE %s",    command, CATMODE);   strcpy (command, tmpline);
    303     snprintf (tmpline, DVO_MAX_PATH, "%s -D CATFORMAT %s",  command, CATFORMAT); strcpy (command, tmpline);
    304     snprintf (tmpline, DVO_MAX_PATH, "%s -D SKY_DEPTH %d",  command, SKY_DEPTH); strcpy (command, tmpline);
     307    strextend (&command, "-D CATMODE %s", CATMODE);
     308    strextend (&command, "-D CATFORMAT %s", CATFORMAT);
     309    strextend (&command, "-D SKY_DEPTH %d", SKY_DEPTH);
    305310
    306311    fprintf (stderr, "command: %s\n", command);
Note: See TracChangeset for help on using the changeset viewer.