Index: /branches/eam_branches/ipp-20150625/Ohana/src/photdbc/include/dvocompress.h
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/photdbc/include/dvocompress.h	(revision 38668)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/photdbc/include/dvocompress.h	(revision 38669)
@@ -16,4 +16,5 @@
 char  *UPDATE_CATFORMAT;  /* internal, elixir, loneos, panstarrs */
 char  *UPDATE_CATCOMPRESS;  /* ?? */
+int    SKIP_COMPRESSED;
 
 SkyRegion REGION;
Index: /branches/eam_branches/ipp-20150625/Ohana/src/photdbc/src/args_dvocompress.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/photdbc/src/args_dvocompress.c	(revision 38668)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/photdbc/src/args_dvocompress.c	(revision 38669)
@@ -30,4 +30,10 @@
     UPDATE_CATCOMPRESS = strcreate (argv[N]);
     remove_argument (N, argc, argv);
+  }
+
+  SKIP_COMPRESSED = FALSE;
+  if ((N = get_argument (*argc, argv, "-skip-compressed"))) {
+    remove_argument (N, argc, argv);
+    SKIP_COMPRESSED = TRUE;
   }
 
@@ -149,4 +155,10 @@
     UPDATE_CATCOMPRESS = strcreate (argv[N]);
     remove_argument (N, argc, argv);
+  }
+
+  SKIP_COMPRESSED = FALSE;
+  if ((N = get_argument (*argc, argv, "-skip-compressed"))) {
+    remove_argument (N, argc, argv);
+    SKIP_COMPRESSED = TRUE;
   }
 
Index: /branches/eam_branches/ipp-20150625/Ohana/src/photdbc/src/dvocompress_catalogs.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/photdbc/src/dvocompress_catalogs.c	(revision 38668)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/photdbc/src/dvocompress_catalogs.c	(revision 38669)
@@ -35,4 +35,38 @@
       DVO_LOAD_GALPHOT;
 
+    // XXX this is fairly ad-hoc : I'd like to be able to check that the operation below
+    // is a NOOP, but I don't want to put in all the full logic at the moment.  instead,
+    // since I know I just want to compress previously uncompressed catalogs, I'm just
+    // going to get the cpt header and check for ZTABLE.  Too bad my APIs force me to read
+    // the header in full here and then again in dvo_catalog_open.
+
+    if (SKIP_COMPRESSED) {
+      FILE *f = fopen (catalog.filename, "r");
+      if (!f) { fprintf (stderr, "cannot open %s, skipping\n", catalog.filename); continue; }
+
+      Header header;
+      if (!gfits_fread_Xheader (f, &header, 0)) { 
+	fprintf (stderr, "cannot read header for %s, skipping\n", catalog.filename);
+	fclose (f);
+	continue;
+      }
+
+      int isZtable;
+      int ztableStatus = gfits_scan_alt (&header, "ZTABLE", "%t", 1, &isZtable);
+
+      fclose (f);
+      gfits_free_header (&header);
+
+      if (ztableStatus && isZtable) {
+	fprintf (stderr, "%s is compressed, skipping\n", catalog.filename);
+	continue;
+      }
+    }
+
+    // XXX for a test, do nothing
+    fprintf (stderr, "%s is not compressed, compressing\n", catalog.filename);
+
+    // ohana_memcheck_func (TRUE);
+
     // an error exit status here is a significant error
     if (!dvo_catalog_open (&catalog, skylist[0].regions[i], (VERBOSE > 1), "w")) {
@@ -40,4 +74,6 @@
       exit (2);
     }
+
+    // ohana_memcheck_func (TRUE);
 
     // skip empty input catalogs
@@ -57,4 +93,6 @@
     } 
 
+    // ohana_memcheck_func (TRUE);
+
     if (!dvo_catalog_backup (&catalog, TRUE)) {
       fprintf (stderr, "ERROR: failed to make backup for catalog %s\n", catalog.filename);
@@ -62,8 +100,12 @@
     }
 
+    // ohana_memcheck_func (TRUE);
+
     SetProtect (TRUE);
     if (!dvo_catalog_save (&catalog, (VERBOSE > 1))) { fprintf (stderr, "ERROR: failed to save %s\n", catalog.filename); exit (1); }
     if (!dvo_catalog_unlock (&catalog)) { fprintf (stderr, "ERROR: failed to unlock %s\n", catalog.filename); exit (1); }
     SetProtect (FALSE);
+
+    // ohana_memcheck_func (TRUE);
 
     if (!dvo_catalog_unlink_backup (&catalog, TRUE)) {
@@ -110,4 +152,5 @@
     if (UPDATE_CATCOMPRESS) { strextend (&command, "-set-compress %s", UPDATE_CATCOMPRESS); }
     if (UPDATE_CATFORMAT)   { strextend (&command, "-set-format %s", UPDATE_CATFORMAT); }
+    if (SKIP_COMPRESSED)    { strextend (&command, "-skip-compressed"); }
 
     fprintf (stderr, "command: %s\n", command);
