Index: trunk/pswarp/src/pswarpDefine.c
===================================================================
--- trunk/pswarp/src/pswarpDefine.c	(revision 12523)
+++ trunk/pswarp/src/pswarpDefine.c	(revision 12526)
@@ -18,5 +18,8 @@
     }
 
-    // open the full skycell file; no need to defer different depths
+    // open the full skycell file; no need to defer different depths. only load the header data
+    // XXX force fileLevel and view to be chip. is this right?
+    // skycell->type = PM_FPA_FILE_HEADER;
+    // skycell->fileLevel = PM_FPA_LEVEL_CHIP;
     pmFPAview *view = pmFPAviewAlloc (0);
     pmFPAfileOpen (skycell, view, config);
@@ -49,6 +52,37 @@
 	return false;
     }
+    // output->fileLevel = PM_FPA_LEVEL_CHIP;
 
     pmFPAfileCreate(output, view, config);
+
+# if 0
+    // XXX This function should only load the skycell headers and create the output based
+    // on that file.  I'm going to ask paul to look into this
+    pmFPACopyStructure (output->fpa, skycell->fpa, 1, 1);
+
+    // XXX can I just create the needed readout?
+    // create the needed readouts
+    for (int i = 0; i < output->fpa->chips->n; i++) {
+	pmChip *chip = output->fpa->chips->data[i];
+	for (int j = 0; j < chip->cells->n; j++) {
+	    pmCell *cell = chip->cells->data[j];
+	    pmReadout *readout;
+	    if (cell->readouts->n == 0) {
+		readout = pmReadoutAlloc (cell);
+	    }
+	    bool mdok1 = false;
+	    bool mdok2 = false;
+	    pmHDU *hdu = pmHDUGetLowest (output->fpa, chip, cell);
+	    int Nx = psMetadataLookupS32(&mdok1, hdu->header, "NAXIS1"); // Trim section
+	    int Ny = psMetadataLookupS32(&mdok2, hdu->header, "NAXIS2"); // Trim section
+	    if (!mdok1 || !mdok2) {
+		psError(PS_ERR_IO, true, "NAXIS1 or NAXIS2 not set --- unable to create output image.\n");
+		return false;
+	    }
+	    readout->image = psImageAlloc (Nx, Ny, PS_TYPE_F32);
+	    psFree (readout);
+	}
+    }
+# endif
 
     psFree (view);
