Index: trunk/pswarp/src/pswarpDefineLayout.c
===================================================================
--- trunk/pswarp/src/pswarpDefineLayout.c	(revision 41526)
+++ trunk/pswarp/src/pswarpDefineLayout.c	(revision 42947)
@@ -11,5 +11,5 @@
 # include "pswarp.h"
 
-bool pswarpGenerateOutputCell (pmChip *chip, pmCell *cell, pmCell *refcell, float xBin, float yBin);
+bool pswarpGenerateOutputCell (pmChip *chip, pmCell *cell, pmCell *refcell, float xBin, float yBin, float zptObs, float zptErr);
 
 // load the astrometry header info and generate the tranformations 
@@ -17,4 +17,6 @@
 
     bool status = false;
+    float zptObs = 0.;
+    float zptErr = 0.;
 
     pmFPAfile *output = psMetadataLookupPtr(&status, config->files, "PSWARP.OUTPUT");
@@ -29,8 +31,9 @@
         return false;
     }
-    if (!pswarpLoadAstrometry (output, skycell, config)) {
+    if (!pswarpLoadAstrometry (output, skycell, config,&zptObs,&zptErr)) {
         psError(PSWARP_ERR_CONFIG, false, "problem loading output astrometry\n");
         return false;
     }
+
 
     // if a background model is supplied and the output is requested, then 
@@ -68,5 +71,5 @@
 	    return false;
 	}
-	if (!pswarpLoadAstrometry (input, astrom, config)) {
+	if (!pswarpLoadAstrometry (input, astrom, config,&zptObs,&zptErr)) {
 	    psError(PSWARP_ERR_CONFIG, false, "problem loading input astrometry\n");
 	    return false;
@@ -126,14 +129,19 @@
 	    pmCell *refcell = pmFPAviewThisCell(view, skycell->fpa); ///< Target cell
 
-	    if (!pswarpGenerateOutputCell (chip, cell, refcell, output->xBin, output->yBin)){
+	    if (!pswarpGenerateOutputCell (chip, cell, refcell, output->xBin, output->yBin,zptObs,zptErr)){
 		psError(PSWARP_ERR_DATA, false, "failed to generate output cell");
 		psFree(view);
 		return false;
 	    }
+	    
+	    //also output the skycell id
+	    char *skycell_id = psMetadataLookupStr(&status, config->arguments, "SKYCELL_ID");
+            pmHDU *outHDU = pmHDUFromCell (cell);           ///< HDU for the output warped image
+            psMetadataAddStr (outHDU->header, PS_LIST_TAIL, "SKYCELL_ID", PS_META_REPLACE, "skycell_id",  skycell_id);
 
 	    if (bkgModel) {
 		pmChip *bkgChip = pmFPAviewThisChip(view, bkgModel->fpa); ///< Target cell
 		pmCell *bkgCell = pmFPAviewThisCell(view, bkgModel->fpa); ///< Target cell
-		if (!pswarpGenerateOutputCell (bkgChip, bkgCell, refcell, bkgModel->xBin, bkgModel->yBin)) {
+		if (!pswarpGenerateOutputCell (bkgChip, bkgCell, refcell, bkgModel->xBin, bkgModel->yBin,zptObs,zptErr)) {
 		    psError(PSWARP_ERR_DATA, false, "failed to generate output cell");
 		    psFree(view);
@@ -152,5 +160,5 @@
 }
 
-bool pswarpGenerateOutputCell (pmChip *chip, pmCell *cell, pmCell *refcell, float xBin, float yBin) {
+bool pswarpGenerateOutputCell (pmChip *chip, pmCell *cell, pmCell *refcell, float xBin, float yBin, float zptObs, float zptErr) {
 
     bool status = false;
@@ -197,4 +205,7 @@
     pmHDU *outHDU = pmHDUFromCell (cell);           ///< HDU for the output warped image
     outHDU->header = psMetadataCopy(outHDU->header, hdu->header);
+
+    psMetadataAddF32 (outHDU->header, PS_LIST_TAIL, "ZPT_OBS", PS_META_REPLACE, "measured zero point",  zptObs);
+    psMetadataAddF32 (outHDU->header, PS_LIST_TAIL, "ZPT_ERR", PS_META_REPLACE, "error on zero point",  zptErr);
     pswarpVersionHeader(outHDU->header);
     return true;
