Index: /branches/eam_branches/ipp-20110404/Ohana/src/addstar/include/skycells.h
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/addstar/include/skycells.h	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/addstar/include/skycells.h	(revision 31440)
@@ -65,4 +65,5 @@
 int    NMAX;
 int    NX_SUB, NY_SUB;
+int    X_PARITY;
 double SCALE;
 double PADDING;
Index: /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/GetFileMode.c
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/GetFileMode.c	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/GetFileMode.c	(revision 31440)
@@ -4,5 +4,5 @@
 int GetFileMode (Header *header) {
 
-  char ctype[80], ctmp;
+  char ctype[81], ctmp[80];
   int Naxis;
   int simple, extend, haveNaxis, haveCTYPE;
@@ -17,6 +17,6 @@
   // SDSS tsObj files have a version number for the PHOTO and 
   // TS (target selection) pipelines present as header keywords
-  havePHOT_VER = gfits_scan (header, "PHOT_VER", "%s", 1, &ctmp);
-  haveTARG_VER = gfits_scan (header, "TARG_VER", "%s", 1, &ctmp);
+  havePHOT_VER = gfits_scan (header, "PHOT_VER", "%s", 1, ctmp);
+  haveTARG_VER = gfits_scan (header, "TARG_VER", "%s", 1, ctmp);
   if (havePHOT_VER && haveTARG_VER) return SDSS_OBJ;
 
Index: /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/ReadImageHeader.c
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/ReadImageHeader.c	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/ReadImageHeader.c	(revision 31440)
@@ -6,5 +6,5 @@
 
   int Nastro, hour, min, Nx, Ny, haveNx, haveNy, sourceID;
-  double tmp, sec, Cerror, ZeroPt, FWHM_X, FWHM_Y;
+  double tmp, sec, Cerror, FWHM_X, FWHM_Y;
   char *c, photname[64], line[80], ccdnum[64];
   PhotCode *photcodeData = NULL;
@@ -205,12 +205,15 @@
   }
 
+#ifdef notdef
   // XXX this is archaic: we used to set a fixed zero point of 25 to shift data into the range
   // 0 - 32 so it would fit in an unsigned int.  This is also needed because some programs like
   // sextractor will put in an arbitrary zero point that we need to understand to get back to
   // instrumental mags.
+  double ZeroPt;
   gfits_scan (header, "ZERO_PT", "%lf", 1, &ZeroPt);
   if (ZeroPt != GetZeroPoint()) {
       fprintf (stderr, "WARNING: inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint());
   }
+#endif
 
   // in this case, lookup and apply the zero point measured for this chip
Index: /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/args_skycells.c
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/args_skycells.c	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/args_skycells.c	(revision 31440)
@@ -85,13 +85,4 @@
       fprintf (stderr, "missing -size dRA dDEC for LOCAL mode\n");
       help ();
-    }
-    OVERLAP_RA = 0;
-    OVERLAP_DEC = 0;
-    if ((N = get_argument (argc, argv, "-overlap"))) {
-      remove_argument (N, &argc, argv);
-      OVERLAP_RA  = atof (argv[N]);
-      remove_argument (N, &argc, argv);
-      OVERLAP_DEC  = atof (argv[N]);
-      remove_argument (N, &argc, argv);
     }
     PROJECTION_NUMBER[0] = 0;
@@ -187,4 +178,19 @@
       help ();
     }  
+    remove_argument (N, &argc, argv);
+  }
+
+  OVERLAP_RA = 0;
+  OVERLAP_DEC = 0;
+  if ((N = get_argument (argc, argv, "-overlap"))) {
+    remove_argument (N, &argc, argv);
+    OVERLAP_RA  = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    OVERLAP_DEC  = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+  X_PARITY = 1;
+  if ((N = get_argument (argc, argv, "-skyparity"))) {
+    X_PARITY = -1;
     remove_argument (N, &argc, argv);
   }
@@ -223,5 +229,7 @@
   fprintf (stderr, "  -nx Nx                      : subdivide skycell projection in x by Nx\n");
   fprintf (stderr, "  -ny Ny                      : subdivide skycell projection in y by Ny\n");
+  fprintf (stderr, "  -overlap Or Od              : overlap between skycells (arcseconds)\n");
   fprintf (stderr, "  -projection-number Np       : set projection-number (local mode only)\n");
+  fprintf (stderr, "  -skyparity                  : set wcs for skycells so that east is to the left\n");
   fprintf (stderr, "  -help                       : this list\n");
   fprintf (stderr, "  -h                          : this list\n\n");
Index: /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/sky_tessalation.c
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/sky_tessalation.c	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/addstar/src/sky_tessalation.c	(revision 31440)
@@ -318,5 +318,6 @@
   memset (image, 0, sizeof(Image));
   image[0].coords = *refcoords;
-  image[0].coords.pc1_1 = image[0].coords.pc2_2 = 1.0;
+  image[0].coords.pc1_1 = 1.0 * X_PARITY;
+  image[0].coords.pc2_2 = 1.0;
   image[0].coords.pc1_2 = image[0].coords.pc2_1 = 0.0;
 
@@ -468,5 +469,5 @@
 
   if (FIX_NS) {
-    rectangle[0].coords.pc1_1 = +1.0;
+    rectangle[0].coords.pc1_1 = +1.0 * X_PARITY;
     rectangle[0].coords.pc1_2 = +0.0;
     rectangle[0].coords.pc2_1 = -0.0;
@@ -475,7 +476,7 @@
     ycr = yc*cos(angle) + xc*sin(angle); 
   } else {
-    rectangle[0].coords.pc1_1 = +cos(angle);
+    rectangle[0].coords.pc1_1 = +cos(angle) * X_PARITY;
     rectangle[0].coords.pc1_2 = +sin(angle);
-    rectangle[0].coords.pc2_1 = -sin(angle);
+    rectangle[0].coords.pc2_1 = -sin(angle) * X_PARITY;
     rectangle[0].coords.pc2_2 = +cos(angle);
     xcr = xc;
@@ -514,12 +515,12 @@
   angle = 0.0;
   if (FIX_NS) {
-    rectangle[0].coords.pc1_1 = +1.0;
+    rectangle[0].coords.pc1_1 = +1.0 * X_PARITY;
     rectangle[0].coords.pc1_2 = +0.0;
     rectangle[0].coords.pc2_1 = -0.0;
     rectangle[0].coords.pc2_2 = +1.0;
   } else {
-    rectangle[0].coords.pc1_1 = +cos(angle);
+    rectangle[0].coords.pc1_1 = +cos(angle) * X_PARITY;
     rectangle[0].coords.pc1_2 = +sin(angle);
-    rectangle[0].coords.pc2_1 = -sin(angle);
+    rectangle[0].coords.pc2_1 = -sin(angle) * X_PARITY;
     rectangle[0].coords.pc2_2 = +cos(angle);
   }
@@ -626,5 +627,5 @@
     ring[i].coords.crval2 = dec;
 
-    ring[i].coords.pc1_1 = +1.0;
+    ring[i].coords.pc1_1 = +1.0 * X_PARITY;
     ring[i].coords.pc1_2 = +0.0;
     ring[i].coords.pc2_1 = -0.0;
Index: /branches/eam_branches/ipp-20110404/Ohana/src/dvomerge/src/dvomergeCreate.c
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/dvomerge/src/dvomergeCreate.c	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/dvomerge/src/dvomergeCreate.c	(revision 31440)
@@ -93,5 +93,5 @@
 
   // save the output photcodes in the output catdir
-  // SetPhotcodeTable(outputPhotcodes);
+  SetPhotcodeTable(outputPhotcodes);
   sprintf (filename, "%s/Photcodes.dat", output);
   if (!check_file_access (filename, TRUE, TRUE, VERBOSE)) {
@@ -129,13 +129,7 @@
     if (VERBOSE) fprintf (stderr, "output: %s\n", outsky[0].regions[i].name);
 
-    // if (outputPhotcodes) {
-    //     SetPhotcodeTable(outputPhotcodes);
-    // }
     // load / create output catalog
     LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w", NsecfiltOutput);
 
-    // if (input1Photcodes) {
-    // SetPhotcodeTable(input1Photcodes);
-    // }
     // combine only tables at equal or larger depth
       
@@ -161,8 +155,4 @@
     SkyListFree (inlist);
 
-    // if (input2Photcodes) {
-    //   SetPhotcodeTable(input2Photcodes);
-    // }
-
     // load in all of the tables from input2 for this region
     inlist = SkyListByBounds (insky2, depth2, outsky[0].regions[i].Rmin, outsky[0].regions[i].Rmax, outsky[0].regions[i].Dmin, outsky[0].regions[i].Dmax);
Index: /branches/eam_branches/ipp-20110404/Ohana/src/getstar/include/dvoImagesAtCoords.h
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/getstar/include/dvoImagesAtCoords.h	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/getstar/include/dvoImagesAtCoords.h	(revision 31440)
@@ -7,4 +7,5 @@
 
 int       VERBOSE;
+int       LISTCHIPCOORDS;
 
 char OUTPUT[256];
@@ -19,9 +20,15 @@
 
 typedef struct {
+    int     n;
+    double  x;
+    double  y;
+} Match;
+
+typedef struct {
     int     id;
     double  ra;
     double  dec;
     int     Nmatches;
-    int     *matches;
+    Match   *matches;
     int     arrayLength;
 } Point;
Index: /branches/eam_branches/ipp-20110404/Ohana/src/getstar/src/MatchCoords.c
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/getstar/src/MatchCoords.c	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/getstar/src/MatchCoords.c	(revision 31440)
@@ -93,10 +93,12 @@
             totalMatches++;
 
-            pt->matches[pt->Nmatches] = i;
+            pt->matches[pt->Nmatches].n = i;
+            pt->matches[pt->Nmatches].x = x;
+            pt->matches[pt->Nmatches].y = y;
             pt->Nmatches ++;
 
             if (pt->Nmatches == pt->arrayLength) {
                 pt->arrayLength += 20;
-                REALLOCATE (pt->matches, int, pt->arrayLength);
+                REALLOCATE (pt->matches, Match, pt->arrayLength);
             }
         }
Index: /branches/eam_branches/ipp-20110404/Ohana/src/getstar/src/args_coords.c
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/getstar/src/args_coords.c	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/getstar/src/args_coords.c	(revision 31440)
@@ -41,4 +41,9 @@
 
   /* check for command line options */
+  LISTCHIPCOORDS = FALSE;
+  if ((N = get_argument (argc, argv, "-listchipcoords"))) {
+    LISTCHIPCOORDS = TRUE;
+    remove_argument (N, &argc, argv);
+  }
   WITH_PHU = FALSE;
   if ((N = get_argument (argc, argv, "+phu"))) {
Index: /branches/eam_branches/ipp-20110404/Ohana/src/getstar/src/dvoImagesAtCoords.c
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/getstar/src/dvoImagesAtCoords.c	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/getstar/src/dvoImagesAtCoords.c	(revision 31440)
@@ -91,5 +91,5 @@
     while ((Nread = fscanf(f, "%d %lf %lf\n", &pts[Npoints].id, &pts[Npoints].ra, &pts[Npoints].dec)) == 3) {
         pts[Npoints].Nmatches = 0;
-        ALLOCATE(pts[Npoints].matches, int, 20);
+        ALLOCATE(pts[Npoints].matches, Match, 20);
         pts[Npoints].arrayLength = 20;
 
@@ -118,5 +118,5 @@
     pts[0].dec = dec;
     pts[0].Nmatches = 0;
-    ALLOCATE(pts[0].matches, int, 20);
+    ALLOCATE(pts[0].matches, Match, 20);
     pts[0].arrayLength = 20;
 
@@ -133,5 +133,7 @@
       Point *pt = points + j;
       for (i = 0; i < pt->Nmatches; i++) {
-        int N = pt->matches[i];
+        int N = pt->matches[i].n;
+        double x = pt->matches[i].x;
+        double y = pt->matches[i].y;
 
         char *name;
@@ -150,5 +152,9 @@
             name = dbImages[N].name;
         }
-        fprintf (stdout, "%d %lf %lf %s\n", pt->id, pt->ra, pt->dec, name);
+        if (LISTCHIPCOORDS) {
+            fprintf (stdout, "%d %lf %lf %s %8.2lf %8.2lf\n", pt->id, pt->ra, pt->dec, name, x, y);
+        } else {
+            fprintf (stdout, "%d %lf %lf %s\n", pt->id, pt->ra, pt->dec, name);
+        }
         if  (copy) {
             free(copy);
Index: /branches/eam_branches/ipp-20110404/Ohana/src/libfits/table/F_get_column.c
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/libfits/table/F_get_column.c	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/libfits/table/F_get_column.c	(revision 31440)
@@ -30,9 +30,9 @@
   tlabel[0] = 0;
   if (!gfits_scan (header, "TFIELDS", "%d", 1, &Nfields)) return (NULL);
-  for (i = 1; strcmp (label, tlabel) && (i < Nfields + 1); i++) {
+  for (i = 1; strcasecmp (label, tlabel) && (i < Nfields + 1); i++) {
     sprintf (field, "TTYPE%d", i);
     gfits_scan (header, field, "%s", 1, tlabel);
   }
-  if (strcmp (label, tlabel)) return (NULL);
+  if (strcasecmp (label, tlabel)) return (NULL);
   N = i - 1;
 
@@ -137,9 +137,9 @@
   tlabel[0] = 0;
   gfits_scan (header, "TFIELDS", "%d", 1, &Nfields);
-  for (i = 1; strcmp (label, tlabel) && (i < Nfields + 1); i++) {
+  for (i = 1; strcasecmp (label, tlabel) && (i < Nfields + 1); i++) {
     sprintf (field, "TTYPE%d", i);
     gfits_scan (header, field, "%s", 1, tlabel);
   }
-  if (strcmp (label, tlabel)) return (FALSE);
+  if (strcasecmp (label, tlabel)) return (FALSE);
   N = i - 1;
 
@@ -166,9 +166,9 @@
   tlabel[0] = 0;
   gfits_scan (header, "TFIELDS", "%d", 1, &Nfields);
-  for (i = 1; strcmp (label, tlabel) && (i < Nfields + 1); i++) {
+  for (i = 1; strcasecmp (label, tlabel) && (i < Nfields + 1); i++) {
     sprintf (field, "TTYPE%d", i);
     gfits_scan (header, field, "%s", 1, tlabel);
   }
-  if (strcmp (label, tlabel)) return (FALSE);
+  if (strcasecmp (label, tlabel)) return (FALSE);
   N = i - 1;
 
@@ -291,9 +291,9 @@
   tlabel[0] = 0;
   gfits_scan (header, "TFIELDS", "%d", 1, &Nfields);
-  for (i = 1; strcmp (label, tlabel) && (i < Nfields + 1); i++) {
+  for (i = 1; strcasecmp (label, tlabel) && (i < Nfields + 1); i++) {
     sprintf (field, "TTYPE%d", i);
     gfits_scan (header, field, "%s", 1, tlabel);
   }
-  if (strcmp (label, tlabel)) return (FALSE);
+  if (strcasecmp (label, tlabel)) return (FALSE);
   N = i - 1;
 
@@ -321,9 +321,9 @@
   tlabel[0] = 0;
   gfits_scan (header, "TFIELDS", "%d", 1, &Nfields);
-  for (i = 1; strcmp (label, tlabel) && (i < Nfields + 1); i++) {
+  for (i = 1; strcasecmp (label, tlabel) && (i < Nfields + 1); i++) {
     sprintf (field, "TTYPE%d", i);
     gfits_scan (header, field, "%s", 1, tlabel);
   }
-  if (strcmp (label, tlabel)) return (FALSE);
+  if (strcasecmp (label, tlabel)) return (FALSE);
   N = i - 1;
 
Index: /branches/eam_branches/ipp-20110404/Ohana/src/libfits/table/F_set_column.c
===================================================================
--- /branches/eam_branches/ipp-20110404/Ohana/src/libfits/table/F_set_column.c	(revision 31439)
+++ /branches/eam_branches/ipp-20110404/Ohana/src/libfits/table/F_set_column.c	(revision 31440)
@@ -31,9 +31,9 @@
   tlabel[0] = 0;
   gfits_scan (header, "TFIELDS", "%d", 1, &Nfields);
-  for (i = 1; strcmp (label, tlabel) && (i < Nfields + 1); i++) {
+  for (i = 1; strcasecmp (label, tlabel) && (i < Nfields + 1); i++) {
     sprintf (field, "TTYPE%d", i);
     gfits_scan (header, field, "%s", 1, tlabel);
   }
-  if (strcmp (label, tlabel)) return (FALSE);
+  if (strcasecmp (label, tlabel)) return (FALSE);
   N = i - 1;
 
