Index: /branches/eam_branches/ipp-20100621/Ohana/src/addstar/include/skycells.h
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/addstar/include/skycells.h	(revision 28797)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/addstar/include/skycells.h	(revision 28798)
@@ -72,4 +72,5 @@
 double CENTER_RA, CENTER_DEC;
 double RANGE_RA,  RANGE_DEC;
+double OVERLAP_RA, OVERLAP_DEC;
 
 double EULER_A;
Index: /branches/eam_branches/ipp-20100621/Ohana/src/addstar/src/args_skycells.c
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/addstar/src/args_skycells.c	(revision 28797)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/addstar/src/args_skycells.c	(revision 28798)
@@ -86,4 +86,13 @@
       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);
+    }
   }
 
@@ -113,5 +122,5 @@
   }
 
-  /* pixel scale (arcsec/pixel) */
+  /* padding fraction */
   PADDING = 0.0;
   if ((N = get_argument (argc, argv, "-padding"))) {
Index: /branches/eam_branches/ipp-20100621/Ohana/src/addstar/src/sky_tessalation.c
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/addstar/src/sky_tessalation.c	(revision 28797)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/addstar/src/sky_tessalation.c	(revision 28798)
@@ -671,4 +671,8 @@
   snprintf (format, 24, "%s.%%0%dd", input[0].name, Ndigit);
 
+  // if requested extend, the skycell boundaries so that skycells overlap
+  int pad_x = (int) (OVERLAP_RA / SCALE);
+  int pad_y = (int) (OVERLAP_DEC / SCALE);
+
   N = 0;
   for (j = 0; j < Ny; j++) {
@@ -679,10 +683,10 @@
 
       snprintf (output[N].name, DVO_IMAGE_NAME_LEN, format, N);
-      output[N].NX = NX;
-      output[N].NY = NY;
+      output[N].NX = NX + 2 * pad_x;
+      output[N].NY = NY + 2 * pad_y;
       output[N].photcode = input[0].photcode;
 
-      output[N].coords.crpix1 = input[0].coords.crpix1 - i*NX;
-      output[N].coords.crpix2 = input[0].coords.crpix2 - j*NY;
+      output[N].coords.crpix1 = input[0].coords.crpix1 - i*NX + pad_x;
+      output[N].coords.crpix2 = input[0].coords.crpix2 - j*NY + pad_y;
       N++;
     }
Index: /branches/eam_branches/ipp-20100621/Ohana/src/libohana/include/ohana.h
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/libohana/include/ohana.h	(revision 28797)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/libohana/include/ohana.h	(revision 28798)
@@ -140,5 +140,5 @@
 # endif
 # ifdef _DARWIN_C_SOURCE
-# define OFF_T_FMT "%jd"
+# define OFF_T_FMT "%lld"
 #endif
 # ifndef OFF_T_FMT
Index: /branches/eam_branches/ipp-20100621/Ohana/src/relphot/src/bcatalog.c
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/relphot/src/bcatalog.c	(revision 28797)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/relphot/src/bcatalog.c	(revision 28798)
@@ -15,4 +15,5 @@
 
   /* we are moving only the subset of measurements from catalog[0] to subcatalog[0] */
+  memset(subcatalog, 0, sizeof(*subcatalog));
   NAVERAGE = 50;
   NMEASURE = 1000;
Index: /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/include/uniphot.h
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/include/uniphot.h	(revision 28797)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/include/uniphot.h	(revision 28798)
@@ -41,4 +41,5 @@
 typedef struct {
     float zpt;
+    float zpt_err;
     e_time time;
     int found;
Index: /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/src/load_zpt_table.c
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/src/load_zpt_table.c	(revision 28797)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/src/load_zpt_table.c	(revision 28798)
@@ -5,5 +5,5 @@
   int Nzpts, NZPTS;
   ZptTable *zpts;
-  double zpt, mjd;
+  double zpt, mjd, zpt_err;
 
   FILE *f;
@@ -19,8 +19,9 @@
   ALLOCATE (zpts, ZptTable, NZPTS);
 
-  // format is fixed: (time) (zpt)
+  // format is fixed: (time) (zpt) (zpt_err)
   int status;
-  while ((status = fscanf (f, "%lf %lf", &mjd, &zpt)) == 2) {
+  while ((status = fscanf (f, "%lf %lf %lf", &mjd, &zpt, &zpt_err)) == 3) {
     zpts[Nzpts].zpt = zpt;
+    zpts[Nzpts].zpt_err = zpt_err;
     zpts[Nzpts].time = ohana_mjd_to_sec (mjd);
     zpts[Nzpts].found = FALSE;
Index: /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/src/match_zpts_to_images.c
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/src/match_zpts_to_images.c	(revision 28797)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/src/match_zpts_to_images.c	(revision 28798)
@@ -70,4 +70,5 @@
     // we have a match: set zpt and record the match
     image[Ni].Mcal = SCALE*code[0].C - zpts[Nz].zpt;
+    image[Ni].dMcal = zpts[Nz].zpt_err;
     image[Ni].flags &= ~ID_IMAGE_PHOTOM_NOCAL; // clear the NOCAL flag
     zpts[Nz].found = TRUE;
Index: /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/src/update_catalog_setphot.c
===================================================================
--- /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/src/update_catalog_setphot.c	(revision 28797)
+++ /branches/eam_branches/ipp-20100621/Ohana/src/uniphot/src/update_catalog_setphot.c	(revision 28798)
@@ -74,5 +74,5 @@
 
   off_t i, j, m, id, idx, found;
-  float Mcal;
+  float Mcal, dMcal;
 
   found = 0;    
@@ -86,6 +86,8 @@
       id = index[idx];
       Mcal = image[id].Mcal;
+      dMcal = image[id].dMcal;
 
-      catalog[0].measure[m].Mcal = image[id].Mcal;
+      catalog[0].measure[m].Mcal = Mcal;
+      catalog[0].measure[m].dMcal = dMcal;
       found ++;
     }
