Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h	(revision 33402)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h	(revision 33403)
@@ -134,4 +134,5 @@
 int    KEEP_UBERCAL;
 char  *OUTROOT;
+char  *UPDATE_CATFORMAT;
 int    PLOTDELAY;
 int    UpdateAverages;
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c	(revision 33402)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c	(revision 33403)
@@ -162,4 +162,11 @@
   }
 
+  UPDATE_CATFORMAT = NULL;
+  if ((N = get_argument (argc, argv, "-update-catformat"))) {
+    remove_argument (N, &argc, argv);
+    UPDATE_CATFORMAT = strcreate (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+
   SAVE_IMAGE_UPDATES = TRUE;
   if ((N = get_argument (argc, argv, "-skip-image-updates"))) {
@@ -444,4 +451,11 @@
   }  
 
+  UPDATE_CATFORMAT = NULL;
+  if ((N = get_argument (argc, argv, "-update-catformat"))) {
+    remove_argument (N, &argc, argv);
+    UPDATE_CATFORMAT = strcreate (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+
   AreaSelect = FALSE;
   if ((N = get_argument (argc, argv, "-area"))) {
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c	(revision 33402)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c	(revision 33403)
@@ -87,4 +87,8 @@
     TIMESTAMP(time5);
 
+    // modify the output format as desired (ignore current format on disk)
+    if (UPDATE_CATFORMAT) {
+      catalog.catformat = dvo_catalog_catformat (UPDATE_CATFORMAT);
+    }
     dvo_catalog_save (&catalog, VERBOSE); 
     dvo_catalog_unlock (&catalog);
@@ -152,9 +156,10 @@
     
     char tmpline[1024];
-    if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    			    strcpy (command, tmpline); }
-    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command); 		     			    strcpy (command, tmpline); }
-    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command); 		     			    strcpy (command, tmpline); }
-    if (KEEP_UBERCAL)  { snprintf (tmpline, 1024, "%s -keep-ubercal",   command); 		     strcpy (command, tmpline); }
-    if (AreaSelect)    { snprintf (tmpline, 1024, "%s -area %f %f %f %f", command, AreaXmin, AreaXmax, AreaYmin, AreaYmax); strcpy (command, tmpline); }
+    if (VERBOSE)          { snprintf (tmpline, 1024, "%s -v",           	command);                    			  strcpy (command, tmpline); }
+    if (VERBOSE2)         { snprintf (tmpline, 1024, "%s -vv",          	command); 		     			  strcpy (command, tmpline); }
+    if (RESET)            { snprintf (tmpline, 1024, "%s -reset",       	command); 		     			  strcpy (command, tmpline); }
+    if (KEEP_UBERCAL)     { snprintf (tmpline, 1024, "%s -keep-ubercal",	command); 		                          strcpy (command, tmpline); }
+    if (UPDATE_CATFORMAT) { snprintf (tmpline, 1024, "%s -update-catformat %s", command, UPDATE_CATFORMAT); 		          strcpy (command, tmpline); }
+    if (AreaSelect)       { snprintf (tmpline, 1024, "%s -area %f %f %f %f",    command, AreaXmin, AreaXmax, AreaYmin, AreaYmax); strcpy (command, tmpline); }
     if (TimeSelect) { 
       char *tstart = ohana_sec_to_date (TSTART);
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot.c	(revision 33402)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot.c	(revision 33403)
@@ -217,5 +217,12 @@
     dbX.virtual = FALSE;
 
-    // copy Images.dat to another structure
+    // save Images.dat using the copied structure
+    if (UPDATE_CATFORMAT) {
+      // ensure the db format is updated
+      dbX.format = dvo_catalog_catformat (UPDATE_CATFORMAT);
+      char photcodeFile[1024];
+      sprintf (photcodeFile, "%s/Photcodes.dat", CATDIR);
+      SavePhotcodesFITS (photcodeFile);
+    }
     dvo_image_save (&dbX, VERBOSE);
     dvo_image_unlock (&dbX); 
@@ -245,4 +252,8 @@
   MARKTIME("-- updated all catalogs: %f sec\n", dtime);
 
+  if (UPDATE_CATFORMAT) {
+    // ensure the db format is updated
+    db.format = dvo_catalog_catformat (UPDATE_CATFORMAT);
+  }
   dvo_image_update (&db, VERBOSE);
   dvo_image_unlock (&db); 
