Index: /trunk/Ohana/src/libautocode/Makefile.Targets
===================================================================
--- /trunk/Ohana/src/libautocode/Makefile.Targets	(revision 13883)
+++ /trunk/Ohana/src/libautocode/Makefile.Targets	(revision 13884)
@@ -6,4 +6,5 @@
 $(ASRC)/average-elixir.$(ARCH).o \
 $(ASRC)/average-panstarrs-dev-0.$(ARCH).o \
+$(ASRC)/average-panstarrs-dev-1.$(ARCH).o \
 $(ASRC)/average-panstarrs.$(ARCH).o \
 $(ASRC)/average-pmtest.$(ARCH).o \
@@ -12,4 +13,5 @@
 $(ASRC)/secfilt-elixir.$(ARCH).o \
 $(ASRC)/secfilt-panstarrs-dev-0.$(ARCH).o \
+$(ASRC)/secfilt-panstarrs-dev-1.$(ARCH).o \
 $(ASRC)/secfilt-panstarrs.$(ARCH).o \
 $(ASRC)/measure.$(ARCH).o \
@@ -17,4 +19,5 @@
 $(ASRC)/measure-elixir.$(ARCH).o \
 $(ASRC)/measure-panstarrs-dev-0.$(ARCH).o \
+$(ASRC)/measure-panstarrs-dev-1.$(ARCH).o \
 $(ASRC)/measure-panstarrs.$(ARCH).o \
 $(ASRC)/missing.$(ARCH).o \
@@ -24,4 +27,5 @@
 $(ASRC)/image-elixir.$(ARCH).o \
 $(ASRC)/image-panstarrs-dev-0.$(ARCH).o \
+$(ASRC)/image-panstarrs-dev-1.$(ARCH).o \
 $(ASRC)/image-panstarrs.$(ARCH).o \
 $(ASRC)/regimage.$(ARCH).o \
@@ -44,4 +48,5 @@
 $(AINC)/average-elixir.h \
 $(AINC)/average-panstarrs-dev-0.h \
+$(AINC)/average-panstarrs-dev-1.h \
 $(AINC)/average-panstarrs.h \
 $(AINC)/average-pmtest.h \
@@ -50,4 +55,5 @@
 $(AINC)/secfilt-elixir.h \
 $(AINC)/secfilt-panstarrs-dev-0.h \
+$(AINC)/secfilt-panstarrs-dev-1.h \
 $(AINC)/secfilt-panstarrs.h \
 $(AINC)/measure.h \
@@ -55,4 +61,5 @@
 $(AINC)/measure-elixir.h \
 $(AINC)/measure-panstarrs-dev-0.h \
+$(AINC)/measure-panstarrs-dev-1.h \
 $(AINC)/measure-panstarrs.h \
 $(AINC)/missing.h \
@@ -62,4 +69,5 @@
 $(AINC)/image-elixir.h \
 $(AINC)/image-panstarrs-dev-0.h \
+$(AINC)/image-panstarrs-dev-1.h \
 $(AINC)/image-panstarrs.h \
 $(AINC)/regimage.h \
Index: /trunk/Ohana/src/libautocode/def/average-panstarrs-dev-1.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/average-panstarrs-dev-1.d	(revision 13884)
+++ /trunk/Ohana/src/libautocode/def/average-panstarrs-dev-1.d	(revision 13884)
@@ -0,0 +1,49 @@
+STRUCT       AveragePanstarrs_DEV_1
+EXTNAME      DVO_AVERAGE_PANSTARRS_DEV_1
+TYPE         BINTABLE
+SIZE         72
+DESCRIPTION  DVO Average Object Table
+
+# elements of data structure / FITS table
+
+FIELD R,              RA,         double,           RA,                	       	  decimal degrees 
+FIELD D,              DEC,        double,           DEC,               	       	  decimal degrees 
+FIELD dR,             RA_ERR,     float,            RA error                      arcsec
+FIELD dD,             DEC_ERR,    float,            DEC error                     arcsec
+
+FIELD uR,             U_RA,       float,            RA*cos(D) proper-motion,      arcsec/year
+FIELD uD,             U_DEC,      float,            DEC proper-motion,            arcsec/year
+FIELD duR,            V_RA_ERR,   float,            RA*cos(D) p-m error,          arcsec/year
+FIELD duD,            V_DEC_ERR,  float,            DEC p-m error,                arcsec/year
+FIELD P,              PAR,        float,            parallax,			  arcsec
+FIELD dP,             PAR_ERR,    float,            parallax error,               arcsec
+
+# XXX drop the old primary magnitude concept
+# FIELD M,            MAG,        float,            primary mag,       	       	  mag
+# FIELD dM,           MAG_ERR,    float,            error on primary mag,         mag
+# FIELD Xm,           CHISQ_MAG,  short, 	    chisq for primary mag,        [100*log(value)]
+# FIELD Xg,           CHISQ_GAL,  short,            chisq for galaxy mags,        [100*log(value)]
+
+FIELD Xp,             SIGMA_POS,  short, 	    position scatter,   	  1/100 arcsec
+FIELD Nm,             NMEAS,      unsigned short,   number of measures
+FIELD Nn,             NMISS,      unsigned short,   number of missings
+FIELD code,           code,       unsigned short,   ID code (star; ghost; etc)
+FIELD offset,         offset,     int,     	    offset to first measurement
+FIELD missing,        missing,    int,     	    offset to first missing obs
+
+# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
+FIELD objID_hi,       OBJ_ID_HI,    unsigned int,   ID upper bytes
+FIELD objID_lo,       OBJ_ID_LO,    unsigned int,   ID lower bytes
+
+# this structure should only be used for internal representations
+# the average-FORMAT structures should be used for external representations
+# note that the average magnitudes are stored in the 'secfilt' table (change this name??)
+# the index for the secfilt table is just Nsecfilt times the index for the average table.
+
+# XXX after the rest of the DVO re-org work, remove the magnitude based values from this table
+# and move them to the secfilt table.
+
+# the DVO object IDs are generated internally and are not equivalent to the PSPS object IDs
+# probably need to add position chisq
+
+# XXX include the number of measurements used to determine the positional information?
Index: /trunk/Ohana/src/libautocode/def/image-panstarrs-dev-1.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/image-panstarrs-dev-1.d	(revision 13884)
+++ /trunk/Ohana/src/libautocode/def/image-panstarrs-dev-1.d	(revision 13884)
@@ -0,0 +1,70 @@
+STRUCT       ImagePanstarrs_DEV_1
+EXTNAME      DVO_IMAGE_PANSTARRS_DEV_1
+TYPE         BINTABLE
+SIZE         288
+DESCRIPTION  DVO Image Table 
+
+# elements of the image structure
+
+SUBSTRUCT coords,           COORDS,               Coords,        astrometric data
+SUBFIELD  crval1,           CRVAL1,               double,   	 coordinate at reference pixel
+SUBFIELD  crval2,           CRVAL2,               double,  	 coordinate at reference pixel
+SUBFIELD  crpix1,           CRPIX1,               float,   	 coordinate of reference pixel
+SUBFIELD  crpix2,           CRPIX2,               float,   	 coordinate of reference pixel
+SUBFIELD  cdelt1,           CDELT1,               float,   	 degrees per pixel
+SUBFIELD  cdelt2,           CDELT2,               float,    	 degrees per pixel
+SUBFIELD  pc1_1,            PC1_1,                float,    	 rotation matrix
+SUBFIELD  pc1_2,            PC1_2,                float,    	 rotation matrix
+SUBFIELD  pc2_1,            PC2_1,                float,    	 rotation matrix
+SUBFIELD  pc2_2,            PC2_2,                float,    	 rotation matrix
+SUBFIELD  polyterms,        POLYTERMS,            float[7][2],	 higher order warping terms
+SUBFIELD  ctype,            CTYPE,                char[15],      coordinate type
+SUBFIELD  Npolyterms,       NPOLYTERMS,           char,     	 order of polynomial
+# 120 bytes
+
+FIELD 	  tzero,            TZERO,                e_time,         readout time (row 0)
+FIELD 	  nstar,            NSTAR,                unsigned int,   number of stars on image
+FIELD 	  secz,             SECZ,                 float,      	  airmass,                   mag
+FIELD 	  NX,               NX,                   short,      	  image width
+FIELD 	  NY,               NY,                   short,      	  image height
+FIELD 	  apmifit,          APMIFIT,              float,      	  aperture correction,       mag
+FIELD 	  dapmifit,         DAPMIFIT,             float,      	  apmifit error,             mag
+FIELD 	  Mcal,             MCAL,                 float,      	  calibration mag,           mag
+FIELD 	  dMcal,            DMCAL,                float,      	  error on Mcal,             mag
+FIELD 	  Xm,               XM,                   short,      	  image chisq,               10*log(value)
+FIELD 	  photcode,         PHOTCODE,             short,      	  identifier for CCD,
+FIELD 	  exptime,          EXPTIME,              float,          exposure time,             seconds
+FIELD     sidtime,          ST,			  float,          sidereal time of exposure
+FIELD     latitude,         LAT,		  float,          observatory latitude,      degrees
+# 40 bytes
+
+FIELD 	  name,             NAME,                 char[64],       name of original image 
+FIELD 	  detection_limit,  DETECTION_LIMIT,      unsigned char,  detection limit,           10*mag
+FIELD 	  saturation_limit, SATURATION_LIMIT,     unsigned char,  saturation limit,          10*mag
+FIELD 	  cerror,           CERROR,               unsigned char,  astrometric error,         50*arcsec
+FIELD 	  fwhm_x,           FWHM_X,               unsigned char,  PSF x width,               25*arcsec
+FIELD 	  fwhm_y,           FWHM_Y,               unsigned char,  PSF y width,               25*arcsec
+FIELD 	  trate,            TRATE,                unsigned char,  scan rate,                 100 usec/pixel
+FIELD 	  code,             CODE,                 char,           image quality flag
+FIELD 	  ccdnum,           CCDNUM,               unsigned char,  CCD ID number
+FIELD 	  imageID_hi,       IMAGE_ID_HI,          unsigned int,   ID upper bytes
+FIELD 	  imageID_lo,       IMAGE_ID_LO,          unsigned int,   ID lower bytes
+# 48 bytes 
+
+FIELD 	  dummy,            DUMMY,                char[10],       unused
+FIELD 	  order,            ORDER,                short,      	  Mrel 2D polynomical order 
+FIELD 	  Mx,               MX,                   short,      	  Mrel polyterm
+FIELD 	  My,               MY,                   short,      	  Mrel polyterm
+FIELD 	  Mxx,              MXX,                  short,      	  Mrel polyterm
+FIELD 	  Mxy,              MXY,                  short,      	  Mrel polyterm
+FIELD 	  Myy,              MYY,                  short,      	  Mrel polyterm
+FIELD 	  Mxxx,             MXXX,                 short,      	  Mrel polyterm
+FIELD 	  Mxxy,             MXXY,                 short,      	  Mrel polyterm
+FIELD 	  Mxyy,             MXYY,                 short,      	  Mrel polyterm
+FIELD 	  Myyy,             MYYY,                 short,      	  Mrel polyterm
+FIELD 	  Mxxxx,            MXXXX,                short,      	  Mrel polyterm
+FIELD 	  Mxxxy,            MXXXY,                short,      	  Mrel polyterm
+FIELD 	  Mxxyy,            MXXYY,                short,      	  Mrel polyterm
+FIELD 	  Mxyyy,            MXYYY,                short,      	  Mrel polyterm
+FIELD 	  Myyyy,            MYYYY,                short,      	  Mrel polyterm
+# 40 bytes
Index: /trunk/Ohana/src/libautocode/def/image.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/image.d	(revision 13883)
+++ /trunk/Ohana/src/libautocode/def/image.d	(revision 13884)
@@ -2,5 +2,5 @@
 EXTNAME      DVO_IMAGE
 TYPE         BINTABLE
-SIZE         256
+SIZE         288
 DESCRIPTION  DVO Image Table 
 
@@ -39,5 +39,5 @@
 # 40 bytes
 
-FIELD 	  name,             NAME,                 char[32],       name of original image 
+FIELD 	  name,             NAME,                 char[64],       name of original image 
 FIELD 	  detection_limit,  DETECTION_LIMIT,      unsigned char,  detection limit,           10*mag
 FIELD 	  saturation_limit, SATURATION_LIMIT,     unsigned char,  saturation limit,          10*mag
Index: /trunk/Ohana/src/libautocode/def/measure-panstarrs-dev-1.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/measure-panstarrs-dev-1.d	(revision 13884)
+++ /trunk/Ohana/src/libautocode/def/measure-panstarrs-dev-1.d	(revision 13884)
@@ -0,0 +1,59 @@
+STRUCT       MeasurePanstarrs_DEV_1
+EXTNAME      DVO_MEASURE_PANSTARRS_DEV_1
+TYPE         BINTABLE
+SIZE         96
+DESCRIPTION  DVO Detection Measurement Table 
+
+FIELD dR,             D_RA,         float,          RA offset,                	  arcsec
+FIELD dD,             D_DEC,        float,          DEC offset,               	  arcsec
+FIELD M,              MAG,          float,          catalog mag,       	       	  mag
+FIELD Mcal,           Mcal,         float,          image cal mag,	          mag
+FIELD Mgal,           Mgal,         float,          galaxy mag,			  mag
+FIELD dM,             dM,           float,          mag error,                    mag
+FIELD dt,             dt,           float,          exposure time,                2.5*log(exptime)
+
+# note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
+FIELD airmass,        airmass,      float,          (airmass - 1),		  airmass
+FIELD az,             AZ,           float,          telescope azimuth
+
+# new field elements needed for Pan-STARRS:
+FIELD Xccd,           X_CCD,        float,          X coord on chip,               pixels
+FIELD Yccd,           Y_CCD,        float,          Y coord on chip,               pixels
+
+# could these be packed into fewer bits?
+FIELD Sky,            SKY_FLUX,     float,          local estimate of sky flux,    counts/sec
+FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,    counts/sec
+
+FIELD t,              t,            unsigned int,   time in seconds (UNIX)
+FIELD averef,         averef,       unsigned int,   reference to average entry      
+
+# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
+FIELD detID_hi,       DET_ID_HI,    unsigned int,   ID upper bytes
+FIELD detID_lo,       DET_ID_LO,    unsigned int,   ID lower bytes
+
+FIELD imageID_hi,     IMAGE_ID_HI,  unsigned int,   reference to image
+FIELD imageID_lo,     IMAGE_ID_LO,  unsigned int,   reference to image
+
+FIELD FWx,            FWx,          short,          object fwhm major axis,       1/100 of arcsec 
+FIELD FWy,            FWy,          short,          object fwhm minor axis,       1/100 of arcsec 
+FIELD theta,          theta,        short,          angle wrt ccd X dir,          (0xffff/360) deg
+FIELD photcode,       photcode,     unsigned short, photcode
+
+FIELD flags,          flags,        unsigned short, flags for various uses  
+
+FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,         pixels
+FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,         pixels
+
+# do we need more resolution than a short? should this be a log?
+FIELD qPSF,           PSF_QF,       short,          psf coverage/quality factor
+
+FIELD dophot,         dophot,       char,           dophot type
+FIELD stargal,        stargal,      char,           star-galaxy separator
+
+# we need extra bytes for padding purposes...
+FIELD dummy,          dummy,        char[2],        padding
+
+# float : 13 x 4 = 52
+# int:     6 x 4 = 24
+# short:   8 x 2 = 16
+# char :   2     =  2
Index: /trunk/Ohana/src/libautocode/def/secfilt-panstarrs-dev-1.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/secfilt-panstarrs-dev-1.d	(revision 13884)
+++ /trunk/Ohana/src/libautocode/def/secfilt-panstarrs-dev-1.d	(revision 13884)
@@ -0,0 +1,13 @@
+STRUCT       SecFiltPanstarrs_DEV_1
+EXTNAME      DVO_SECFILT_PANSTARRS_DEV_1
+TYPE         BINTABLE
+SIZE         16
+DESCRIPTION  DVO SecFilt : Secondary Filter Data 
+
+# elements of data structure / FITS table
+FIELD  M,     MAG,      float,                other mags,       mags
+FIELD  dM,    MAG_ERR,  float,                scatter on mag,   mags
+FIELD  Xm,    MAG_CHI,  short,                chisq on mag,     [100*log(value)]
+FIELD  Ncode, NCODE,    short,                number of detections in band
+FIELD  Nused, NUSED,    short,                number of detections used in average
+FIELD  dummy, JUNK,     short,                place holder
Index: /trunk/Ohana/src/libdvo/Makefile
===================================================================
--- /trunk/Ohana/src/libdvo/Makefile	(revision 13883)
+++ /trunk/Ohana/src/libdvo/Makefile	(revision 13884)
@@ -51,4 +51,5 @@
 $(SRC)/dvo_convert_loneos.$(ARCH).o    \
 $(SRC)/dvo_convert_panstarrs_DEV_0.$(ARCH).o \
+$(SRC)/dvo_convert_panstarrs_DEV_1.$(ARCH).o \
 $(SRC)/skyregion_io.$(ARCH).o    \
 $(SRC)/skyregion_gsc.$(ARCH).o    \
Index: /trunk/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /trunk/Ohana/src/libdvo/include/dvo.h	(revision 13883)
+++ /trunk/Ohana/src/libdvo/include/dvo.h	(revision 13884)
@@ -24,5 +24,6 @@
       DVO_FORMAT_PANSTARRS, 
       DVO_FORMAT_PMTEST, 
-      DVO_FORMAT_PANSTARRS_DEV_0
+      DVO_FORMAT_PANSTARRS_DEV_0,
+      DVO_FORMAT_PANSTARRS_DEV_1
 } DVOTableFormat;
 
Index: /trunk/Ohana/src/libdvo/src/dvo_catalog.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_catalog.c	(revision 13883)
+++ /trunk/Ohana/src/libdvo/src/dvo_catalog.c	(revision 13884)
@@ -51,4 +51,5 @@
   if (!strcasecmp (catformat, "PMTEST"))    return (DVO_FORMAT_PMTEST);
   if (!strcasecmp (catformat, "PANSTARRS_DEV_0")) return (DVO_FORMAT_PANSTARRS_DEV_0);
+  if (!strcasecmp (catformat, "PANSTARRS_DEV_1")) return (DVO_FORMAT_PANSTARRS_DEV_1);
   return (DVO_FORMAT_UNDEF);
 }
Index: /trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 13883)
+++ /trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 13884)
@@ -73,4 +73,9 @@
       SecFiltSize = sizeof(SecFiltPanstarrs_DEV_0);
       break;
+    case DVO_FORMAT_PANSTARRS_DEV_1:
+      AverageSize = sizeof(AveragePanstarrs_DEV_1);
+      MeasureSize = sizeof(MeasurePanstarrs_DEV_1);
+      SecFiltSize = sizeof(SecFiltPanstarrs_DEV_1);
+      break;
 # if 0
     case DVO_FORMAT_PANSTARRS:
@@ -262,4 +267,5 @@
   if (catalog[0].catformat == DVO_FORMAT_ELIXIR)    gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "ELIXIR");
   if (catalog[0].catformat == DVO_FORMAT_PANSTARRS_DEV_0) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_0");
+  if (catalog[0].catformat == DVO_FORMAT_PANSTARRS_DEV_1) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_1");
   // if (catalog[0].catformat == DVO_FORMAT_PANSTARRS) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS");
   // if (catalog[0].catformat == DVO_FORMAT_PMTEST)    gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PMTEST");
@@ -371,4 +377,16 @@
       free (tmpAverage);
       break; }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      AveragePanstarrs_DEV_1 *tmpAverage;
+      ALLOCATE (tmpAverage, AveragePanstarrs_DEV_1, MAX (Naverage, 1));
+      nitems = fread (tmpAverage, sizeof(AveragePanstarrs_DEV_1), Naverage, f);
+      if (nitems != Naverage) {
+	fprintf (stderr, "failed to read averages (%d vs %d)\n", nitems, Naverage);
+	return (NULL);
+      }
+      gfits_convert_AveragePanstarrs_DEV_1 (tmpAverage, sizeof(AveragePanstarrs_DEV_1), Naverage);
+      average = AveragePanstarrs_DEV_1_ToInternal (tmpAverage, Naverage);
+      free (tmpAverage);
+      break; }
 # if 0
     case DVO_FORMAT_PANSTARRS: {
@@ -446,4 +464,15 @@
       gfits_convert_AveragePanstarrs_DEV_0 (tmpAverage, sizeof(AveragePanstarrs_DEV_0), Naverage);
       nitems = fwrite (tmpAverage, sizeof(AveragePanstarrs_DEV_0), Naverage, f);
+      free (tmpAverage);
+      if (nitems != Naverage) {
+	fprintf (stderr, "failed to write averages (%d vs %d)\n", nitems, Naverage);
+	return (FALSE);
+      }
+      break; }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      AveragePanstarrs_DEV_1 *tmpAverage;
+      tmpAverage = AverageInternalToPanstarrs_DEV_1 (average, Naverage);
+      gfits_convert_AveragePanstarrs_DEV_1 (tmpAverage, sizeof(AveragePanstarrs_DEV_1), Naverage);
+      nitems = fwrite (tmpAverage, sizeof(AveragePanstarrs_DEV_1), Naverage, f);
       free (tmpAverage);
       if (nitems != Naverage) {
@@ -536,4 +565,16 @@
       free (tmpMeasure);
       break; }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      MeasurePanstarrs_DEV_1 *tmpMeasure;
+      ALLOCATE (tmpMeasure, MeasurePanstarrs_DEV_1, MAX (Nmeasure, 1));
+      nitems = fread (tmpMeasure, sizeof(MeasurePanstarrs_DEV_1), Nmeasure, f);
+      if (nitems != Nmeasure) {
+	fprintf (stderr, "failed to read measures (%d vs %d)\n", nitems, Nmeasure);
+	return (NULL);
+      }
+      gfits_convert_MeasurePanstarrs_DEV_1 (tmpMeasure, sizeof(MeasurePanstarrs_DEV_1), Nmeasure);
+      measure = MeasurePanstarrs_DEV_1_ToInternal (tmpMeasure, Nmeasure);
+      free (tmpMeasure);
+      break; }
 # if 0
     case DVO_FORMAT_PANSTARRS: {
@@ -599,4 +640,15 @@
       gfits_convert_MeasurePanstarrs_DEV_0 (tmpMeasure, sizeof(MeasurePanstarrs_DEV_0), Nmeasure);
       nitems = fwrite (tmpMeasure, sizeof(MeasurePanstarrs_DEV_0), Nmeasure, f);
+      free (tmpMeasure);
+      if (nitems != Nmeasure) {
+	fprintf (stderr, "failed to write measures (%d vs %d)\n", nitems, Nmeasure);
+	return (FALSE);
+      }
+      break; }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      MeasurePanstarrs_DEV_1 *tmpMeasure;
+      tmpMeasure = MeasureInternalToPanstarrs_DEV_1 (measure, Nmeasure);
+      gfits_convert_MeasurePanstarrs_DEV_1 (tmpMeasure, sizeof(MeasurePanstarrs_DEV_1), Nmeasure);
+      nitems = fwrite (tmpMeasure, sizeof(MeasurePanstarrs_DEV_1), Nmeasure, f);
       free (tmpMeasure);
       if (nitems != Nmeasure) {
@@ -678,4 +730,16 @@
       free (tmpSecFilt);
       break; }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      SecFiltPanstarrs_DEV_1 *tmpSecFilt;
+      ALLOCATE (tmpSecFilt, SecFiltPanstarrs_DEV_1, MAX (Nsecfilt, 1));
+      nitems = fread (tmpSecFilt, sizeof(SecFiltPanstarrs_DEV_1), Nsecfilt, f);
+      if (nitems != Nsecfilt) {
+	fprintf (stderr, "failed to read secfilts (%d vs %d)\n", nitems, Nsecfilt);
+	return (NULL);
+      }
+      gfits_convert_SecFiltPanstarrs_DEV_1 (tmpSecFilt, sizeof(SecFiltPanstarrs_DEV_1), Nsecfilt);
+      secfilt = SecFiltPanstarrs_DEV_1_ToInternal (tmpSecFilt, Nsecfilt);
+      free (tmpSecFilt);
+      break; }
 # if 0
     case DVO_FORMAT_PANSTARRS: {
@@ -741,4 +805,15 @@
       gfits_convert_SecFiltPanstarrs_DEV_0 (tmpSecFilt, sizeof(SecFiltPanstarrs_DEV_0), Nsecfilt);
       nitems = fwrite (tmpSecFilt, sizeof(SecFiltPanstarrs_DEV_0), Nsecfilt, f);
+      free (tmpSecFilt);
+      if (nitems != Nsecfilt) {
+	fprintf (stderr, "failed to write secfilts (%d vs %d)\n", nitems, Nsecfilt);
+	return (FALSE);
+      }
+      break; }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      SecFiltPanstarrs_DEV_1 *tmpSecFilt;
+      tmpSecFilt = SecFiltInternalToPanstarrs_DEV_1 (secfilt, Nsecfilt);
+      gfits_convert_SecFiltPanstarrs_DEV_1 (tmpSecFilt, sizeof(SecFiltPanstarrs_DEV_1), Nsecfilt);
+      nitems = fwrite (tmpSecFilt, sizeof(SecFiltPanstarrs_DEV_1), Nsecfilt, f);
       free (tmpSecFilt);
       if (nitems != Nsecfilt) {
Index: /trunk/Ohana/src/libdvo/src/dvo_convert.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert.c	(revision 13883)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert.c	(revision 13884)
@@ -56,4 +56,12 @@
     return (average);
   }
+  if (!strcmp (extname, "DVO_AVERAGE_PANSTARRS_DEV_1")) {
+    AveragePanstarrs_DEV_1 *tmpAverage;
+    tmpAverage = gfits_table_get_AveragePanstarrs_DEV_1 (ftable, Naverage, NULL);
+    average = AveragePanstarrs_DEV_1_ToInternal (tmpAverage, *Naverage);
+    free (tmpAverage);
+    *format = DVO_FORMAT_PANSTARRS_DEV_1;
+    return (average);
+  }
 /* disable the new and minimally-used versions for now.  
    put them back in after dev work is further along
@@ -110,4 +118,10 @@
       free (tmpAverage);
       break; }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      AveragePanstarrs_DEV_1 *tmpAverage;
+      tmpAverage = AverageInternalToPanstarrs_DEV_1 (average, Naverage);
+      gfits_table_set_AveragePanstarrs_DEV_1 (ftable, tmpAverage, Naverage);
+      free (tmpAverage);
+      break; }
 # if 0
     case DVO_FORMAT_PANSTARRS: {
@@ -172,4 +186,12 @@
     return (measure);
   }
+  if (!strcmp (extname, "DVO_MEASURE_PANSTARRS_DEV_1")) {
+    MeasurePanstarrs_DEV_1 *tmpMeasure;
+    tmpMeasure = gfits_table_get_MeasurePanstarrs_DEV_1 (ftable, Nmeasure, NULL);
+    measure = MeasurePanstarrs_DEV_1_ToInternal (tmpMeasure, *Nmeasure);
+    free (tmpMeasure);
+    *format = DVO_FORMAT_PANSTARRS_DEV_1;
+    return (measure);
+  }
 # if 0
   if (!strcmp (extname, "DVO_MEASURE_PANSTARRS") || !strcmp (extname, "DVO_MEASURE_PMTEST")) {
@@ -215,4 +237,10 @@
       free (tmpMeasure);
       break; }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      MeasurePanstarrs_DEV_1 *tmpMeasure;
+      tmpMeasure = MeasureInternalToPanstarrs_DEV_1 (measure, Nmeasure);
+      gfits_table_set_MeasurePanstarrs_DEV_1 (ftable, tmpMeasure, Nmeasure);
+      free (tmpMeasure);
+      break; }
 # if 0
     case DVO_FORMAT_PANSTARRS: {
@@ -271,4 +299,12 @@
     return (secfilt);
   }
+  if (!strcmp (extname, "DVO_SECFILT_PANSTARRS_DEV_1")) {
+    SecFiltPanstarrs_DEV_1 *tmpSecFilt;
+    tmpSecFilt = gfits_table_get_SecFiltPanstarrs_DEV_1 (ftable, Nsecfilt, NULL);
+    secfilt = SecFiltPanstarrs_DEV_1_ToInternal (tmpSecFilt, *Nsecfilt);
+    free (tmpSecFilt);
+    *format = DVO_FORMAT_PANSTARRS_DEV_1;
+    return (secfilt);
+  }
 # if 0
   if (!strcmp (extname, "DVO_SECFILT_PANSTARRS") || !strcmp (extname, "DVO_SECFILT_PMTEST")) {
@@ -313,4 +349,10 @@
       free (tmpSecFilt);
       break; }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      SecFiltPanstarrs_DEV_1 *tmpSecFilt;
+      tmpSecFilt = SecFiltInternalToPanstarrs_DEV_1 (secfilt, Nsecfilt);
+      gfits_table_set_SecFiltPanstarrs_DEV_1 (ftable, tmpSecFilt, Nsecfilt);
+      free (tmpSecFilt);
+      break; }
 # if 0
     case DVO_FORMAT_PANSTARRS: {
@@ -379,4 +421,12 @@
     goto set_header;
   }
+  if (!strcmp (extname, "DVO_IMAGE_PANSTARRS_DEV_1")) {
+    ImagePanstarrs_DEV_1 *tmpimage;
+    *format = DVO_FORMAT_PANSTARRS_DEV_1;
+    tmpimage = gfits_table_get_ImagePanstarrs_DEV_1 (ftable, &Nimage, NULL);
+    ftable[0].buffer = (char *) ImagePanstarrs_DEV_1_ToInternal (tmpimage, Nimage);
+    free (tmpimage);
+    goto set_header;
+  }
 # if 0
   if (!strcmp (extname, "DVO_IMAGE_PANSTARRS") || !strcmp (extname, "DVO_IMAGE_PMTEST")) {
@@ -431,4 +481,11 @@
       free (ftable[0].buffer);
       gfits_table_set_ImagePanstarrs_DEV_0 (ftable, tmpImage, Nimage);
+      free (tmpImage);
+      break; }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      ImagePanstarrs_DEV_1 *tmpImage;
+      tmpImage = ImageInternalToPanstarrs_DEV_1 ((Image *) ftable[0].buffer, Nimage);
+      free (ftable[0].buffer);
+      gfits_table_set_ImagePanstarrs_DEV_1 (ftable, tmpImage, Nimage);
       free (tmpImage);
       break; }
@@ -519,4 +576,21 @@
       vtable[0].size = gfits_matrix_size (theader);
       return (TRUE); }
+    case DVO_FORMAT_PANSTARRS_DEV_1: {
+      ImagePanstarrs_DEV_1 *tmpImage;
+      /* convert table rows from internal to external format */
+      for (i = 0; i < Nrow; i++) {
+	tmpImage = ImageInternalToPanstarrs_DEV_1 ((Image *) vtable[0].buffer[i], 1);
+	gfits_convert_ImagePanstarrs_DEV_1 (tmpImage, sizeof(ImagePanstarrs_DEV_1), 1);
+	free (vtable[0].buffer[i]);
+	vtable[0].buffer[i] = (char *) tmpImage;
+      }
+      /* convert header from old format to new format */
+      gfits_scan (theader, "NAXIS2", "%d", 1, &Nimage);
+      gfits_free_header (theader);
+      gfits_table_mkheader_ImagePanstarrs_DEV_1 (theader);
+      gfits_modify (theader, "NAXIS2", "%d", 1, Nimage);
+      theader[0].Naxis[1] = Nimage;
+      vtable[0].size = gfits_matrix_size (theader);
+      return (TRUE); }
 # if 0
     case DVO_FORMAT_PANSTARRS: {
Index: /trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 13884)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 13884)
@@ -0,0 +1,295 @@
+# include <dvo.h>
+
+/* convert panstarrs-format measures to internal measures */
+Measure *MeasurePanstarrs_DEV_1_ToInternal (MeasurePanstarrs_DEV_1 *in, int Nvalues) {
+
+  int i;
+  Measure *out;
+
+  ALLOCATE (out, Measure, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].dR         = in[i].dR;
+    out[i].dD         = in[i].dD;
+    out[i].M          = in[i].M;
+    out[i].dM         = in[i].dM;
+    out[i].Mcal       = in[i].Mcal;
+    out[i].Mgal       = in[i].Mgal;
+    out[i].airmass    = in[i].airmass;
+    out[i].az         = in[i].az;
+    out[i].dt         = in[i].dt;
+    out[i].FWx 	      = in[i].FWx;
+    out[i].FWy 	      = in[i].FWy;
+    out[i].theta      = in[i].theta;
+    out[i].dophot     = in[i].dophot;
+    out[i].photcode   = in[i].photcode;
+    out[i].t          = in[i].t;
+    out[i].averef     = in[i].averef;
+    out[i].flags      = in[i].flags;
+    out[i].Xccd       = in[i].Xccd;
+    out[i].Yccd       = in[i].Yccd;
+    out[i].dXccd      = in[i].dXccd;
+    out[i].dYccd      = in[i].dYccd;
+    out[i].stargal    = in[i].stargal;
+    out[i].Sky        = in[i].Sky;
+    out[i].dSky       = in[i].dSky;
+    out[i].qPSF       = in[i].qPSF;
+    out[i].detID_hi   = in[i].detID_hi;
+    out[i].detID_lo   = in[i].detID_lo;
+    out[i].imageID_hi = in[i].imageID_hi;
+    out[i].imageID_lo = in[i].imageID_lo;
+  }
+  return (out);
+}
+
+/* convert internal measures to panstarrs-format measures */
+MeasurePanstarrs_DEV_1 *MeasureInternalToPanstarrs_DEV_1 (Measure *in, int Nvalues) {
+
+  int i;
+  MeasurePanstarrs_DEV_1 *out;
+
+  ALLOCATE (out, MeasurePanstarrs_DEV_1, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].dR         = in[i].dR;
+    out[i].dD         = in[i].dD;
+    out[i].M          = in[i].M;
+    out[i].dM         = in[i].dM;
+    out[i].Mcal       = in[i].Mcal;
+    out[i].Mgal       = in[i].Mgal;
+    out[i].airmass    = in[i].airmass;
+    out[i].az         = in[i].az;
+    out[i].dt         = in[i].dt;
+    out[i].FWx 	      = in[i].FWx;
+    out[i].FWy 	      = in[i].FWy;
+    out[i].theta      = in[i].theta;
+    out[i].dophot     = in[i].dophot;
+    out[i].photcode   = in[i].photcode;
+    out[i].t          = in[i].t;
+    out[i].averef     = in[i].averef;
+    out[i].flags      = in[i].flags;
+    out[i].Xccd       = in[i].Xccd;
+    out[i].Yccd       = in[i].Yccd;
+    out[i].dXccd      = in[i].dXccd;
+    out[i].dYccd      = in[i].dYccd;
+    out[i].stargal    = in[i].stargal;
+    out[i].Sky        = in[i].Sky;
+    out[i].dSky       = in[i].dSky;
+    out[i].qPSF       = in[i].qPSF;
+    out[i].detID_hi   = in[i].detID_hi;
+    out[i].detID_lo   = in[i].detID_lo;
+    out[i].imageID_hi = in[i].imageID_hi;
+    out[i].imageID_lo = in[i].imageID_lo;
+  }
+  return (out);
+}
+
+/* convert panstarrs-format averages to internal averages */
+Average *AveragePanstarrs_DEV_1_ToInternal (AveragePanstarrs_DEV_1 *in, int Nvalues) {
+
+  int i;
+  Average *out;
+
+  ALLOCATE (out, Average, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].R        = in[i].R;      
+    out[i].D        = in[i].D;      
+    out[i].Xp       = in[i].Xp;     
+    out[i].Nm       = in[i].Nm;     
+    out[i].Nn       = in[i].Nn;     
+    out[i].code     = in[i].code;   
+    out[i].offset   = in[i].offset; 
+    out[i].missing  = in[i].missing;
+    out[i].dR       = in[i].dR;
+    out[i].dD       = in[i].dD;
+    out[i].uR       = in[i].uR;
+    out[i].uD       = in[i].uD;
+    out[i].duR      = in[i].duR;
+    out[i].duD      = in[i].duD;
+    out[i].P        = in[i].P;
+    out[i].dP       = in[i].dP;
+    out[i].objID_hi = in[i].objID_hi;
+    out[i].objID_lo = in[i].objID_lo;
+  }
+  return (out);
+}
+
+/* convert internal averages to panstarrs-format averages */
+AveragePanstarrs_DEV_1 *AverageInternalToPanstarrs_DEV_1 (Average *in, int Nvalues) {
+
+  int i;
+  AveragePanstarrs_DEV_1 *out;
+
+  ALLOCATE (out, AveragePanstarrs_DEV_1, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].R        = in[i].R;      
+    out[i].D        = in[i].D;      
+    out[i].Xp       = in[i].Xp;     
+    out[i].Nm       = in[i].Nm;     
+    out[i].Nn       = in[i].Nn;     
+    out[i].code     = in[i].code;   
+    out[i].offset   = in[i].offset; 
+    out[i].missing  = in[i].missing;
+    out[i].dR       = in[i].dR;
+    out[i].dD       = in[i].dD;
+    out[i].uR       = in[i].uR;
+    out[i].uD       = in[i].uD;
+    out[i].duR      = in[i].duR;
+    out[i].duD      = in[i].duD;
+    out[i].P        = in[i].P;
+    out[i].dP       = in[i].dP;
+    out[i].objID_hi = in[i].objID_hi;
+    out[i].objID_lo = in[i].objID_lo;
+  }
+  return (out);
+}
+
+/* convert panstarrs-format secfilts to internal secfilts */
+SecFilt *SecFiltPanstarrs_DEV_1_ToInternal (SecFiltPanstarrs_DEV_1 *in, int Nvalues) {
+
+  int i;
+  SecFilt *out;
+
+  ALLOCATE (out, SecFilt, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].M     = in[i].M;      
+    out[i].dM    = in[i].dM;      
+    out[i].Xm    = in[i].Xm;     
+    out[i].Ncode = in[i].Ncode;
+    out[i].Nused = in[i].Nused;
+ }
+  return (out);
+}
+
+/* convert internal secfilts to panstarrs-format secfilts */
+SecFiltPanstarrs_DEV_1 *SecFiltInternalToPanstarrs_DEV_1 (SecFilt *in, int Nvalues) {
+
+  int i;
+  SecFiltPanstarrs_DEV_1 *out;
+
+  ALLOCATE (out, SecFiltPanstarrs_DEV_1, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].M     = in[i].M;      
+    out[i].dM    = in[i].dM;      
+    out[i].Xm    = in[i].Xm;     
+    out[i].Ncode = in[i].Ncode;
+    out[i].Nused = in[i].Nused;
+  }
+  return (out);
+}
+
+/* convert panstarrs-format images to internal images */
+Image *ImagePanstarrs_DEV_1_ToInternal (ImagePanstarrs_DEV_1 *in, int Nvalues) {
+
+  int i;
+  Image *out;
+
+  ALLOCATE (out, Image, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
+    strcpy (out[i].name, in[i].name);
+
+    out[i].tzero    	    = in[i].tzero;
+    out[i].nstar    	    = in[i].nstar;
+    out[i].secz	    	    = in[i].secz;
+    out[i].NX	    	    = in[i].NX;
+    out[i].NY	    	    = in[i].NY;
+    out[i].apmifit  	    = in[i].apmifit;
+    out[i].dapmifit 	    = in[i].dapmifit;
+    out[i].Mcal	    	    = in[i].Mcal;
+    out[i].dMcal    	    = in[i].dMcal;
+    out[i].Xm	    	    = in[i].Xm;
+    out[i].photcode   	    = in[i].photcode;
+    out[i].exptime  	    = in[i].exptime;
+    out[i].sidtime  	    = in[i].sidtime;
+    out[i].latitude  	    = in[i].latitude;
+    out[i].detection_limit  = in[i].detection_limit;
+    out[i].saturation_limit = in[i].saturation_limit;
+    out[i].cerror	    = in[i].cerror;
+    out[i].fwhm_x	    = in[i].fwhm_x;
+    out[i].fwhm_y	    = in[i].fwhm_y;
+    out[i].trate	    = in[i].trate;
+    out[i].code		    = in[i].code;
+    out[i].ccdnum	    = in[i].ccdnum;
+    out[i].imageID_hi	    = in[i].imageID_hi;
+    out[i].imageID_lo	    = in[i].imageID_lo;
+
+    out[i].order	    = in[i].order;
+    out[i].Mx		    = in[i].Mx;
+    out[i].My		    = in[i].My;
+    out[i].Mxx		    = in[i].Mxx;
+    out[i].Mxy		    = in[i].Mxy;
+    out[i].Myy		    = in[i].Myy;
+    out[i].Mxxx		    = in[i].Mxxx;
+    out[i].Mxxy		    = in[i].Mxxy;
+    out[i].Mxyy		    = in[i].Mxyy;
+    out[i].Myyy		    = in[i].Myyy;
+    out[i].Mxxxx	    = in[i].Mxxxx;
+    out[i].Mxxxy	    = in[i].Mxxxy;
+    out[i].Mxxyy	    = in[i].Mxxyy;
+    out[i].Mxyyy	    = in[i].Mxyyy;
+    out[i].Myyyy	    = in[i].Myyyy;
+  }
+  return (out);
+}
+
+/* convert internal images to panstarrs-format images */
+ImagePanstarrs_DEV_1 *ImageInternalToPanstarrs_DEV_1 (Image *in, int Nvalues) {
+
+  int i;
+  ImagePanstarrs_DEV_1 *out;
+
+  ALLOCATE (out, ImagePanstarrs_DEV_1, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
+    strcpy (out[i].name, in[i].name);
+
+    out[i].tzero    	    = in[i].tzero;
+    out[i].nstar    	    = in[i].nstar;
+    out[i].secz	    	    = in[i].secz;
+    out[i].NX	    	    = in[i].NX;
+    out[i].NY	    	    = in[i].NY;
+    out[i].apmifit  	    = in[i].apmifit;
+    out[i].dapmifit 	    = in[i].dapmifit;
+    out[i].Mcal	    	    = in[i].Mcal;
+    out[i].dMcal    	    = in[i].dMcal;
+    out[i].Xm	    	    = in[i].Xm;
+    out[i].photcode   	    = in[i].photcode;
+    out[i].exptime  	    = in[i].exptime;
+    out[i].sidtime  	    = in[i].sidtime;
+    out[i].latitude  	    = in[i].latitude;
+    out[i].detection_limit  = in[i].detection_limit;
+    out[i].saturation_limit = in[i].saturation_limit;
+    out[i].cerror	    = in[i].cerror;
+    out[i].fwhm_x	    = in[i].fwhm_x;
+    out[i].fwhm_y	    = in[i].fwhm_y;
+    out[i].trate	    = in[i].trate;
+    out[i].code		    = in[i].code;
+    out[i].ccdnum	    = in[i].ccdnum;
+    out[i].imageID_hi	    = in[i].imageID_hi;
+    out[i].imageID_lo	    = in[i].imageID_lo;
+
+    out[i].order	    = in[i].order;
+    out[i].Mx		    = in[i].Mx;
+    out[i].My		    = in[i].My;
+    out[i].Mxx		    = in[i].Mxx;
+    out[i].Mxy		    = in[i].Mxy;
+    out[i].Myy		    = in[i].Myy;
+    out[i].Mxxx		    = in[i].Mxxx;
+    out[i].Mxxy		    = in[i].Mxxy;
+    out[i].Mxyy		    = in[i].Mxyy;
+    out[i].Myyy		    = in[i].Myyy;
+    out[i].Mxxxx	    = in[i].Mxxxx;
+    out[i].Mxxxy	    = in[i].Mxxxy;
+    out[i].Mxxyy	    = in[i].Mxxyy;
+    out[i].Mxyyy	    = in[i].Mxyyy;
+    out[i].Myyyy	    = in[i].Myyyy;
+  }
+  return (out);
+}
Index: /trunk/Ohana/src/libdvo/src/dvo_image.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_image.c	(revision 13883)
+++ /trunk/Ohana/src/libdvo/src/dvo_image.c	(revision 13884)
@@ -191,4 +191,5 @@
   if (db[0].format == DVO_FORMAT_ELIXIR)    	  gfits_modify (&db[0].header, "FORMAT", "%s", 1, "ELIXIR");
   if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_0) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_0");
+  if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_1) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_1");
   // if (db[0].format == DVO_FORMAT_PANSTARRS) 	  gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PANSTARRS");
   // if (db[0].format == DVO_FORMAT_PMTEST)    	  gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PMTEST");
Index: /trunk/Ohana/src/libdvo/src/dvo_image_raw.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 13883)
+++ /trunk/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 13884)
@@ -52,4 +52,5 @@
   if (db[0].format == DVO_FORMAT_PANSTARRS) 	  ImageSize = sizeof(ImagePanstarrs);
   if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_0) ImageSize = sizeof(ImagePanstarrs_DEV_0);
+  if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_1) ImageSize = sizeof(ImagePanstarrs_DEV_1);
 
   /* check that filesize makes sense */
@@ -74,4 +75,5 @@
   if (db[0].format == DVO_FORMAT_PANSTARRS) 	  gfits_table_mkheader_ImagePanstarrs (&db[0].theader);
   if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_0) gfits_table_mkheader_ImagePanstarrs_DEV_0 (&db[0].theader);
+  if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_1) gfits_table_mkheader_ImagePanstarrs_DEV_1 (&db[0].theader);
     
   /* read data from file */
Index: /trunk/Ohana/src/opihi/dvo/mextract.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/mextract.c	(revision 13883)
+++ /trunk/Ohana/src/opihi/dvo/mextract.c	(revision 13884)
@@ -7,5 +7,5 @@
   char *RegionName, *RegionList, *p;
   double *M1;
-  char **cstack;
+  char **cstack, name[1024];
   float *values;
 
@@ -63,5 +63,10 @@
   ALLOCATE (vec, Vector *, Nreturn);
   for (i = 0; i < Nreturn; i++) {
-    if ((vec[i] = SelectVector (fields[i].name, ANYVECTOR, TRUE)) == NULL) goto escape;
+    if (ISNUM(fields[i].name[0])) {
+      sprintf (name, "v_%s", fields[i].name);
+    } else {
+      sprintf (name, "%s", fields[i].name);
+    }
+    if ((vec[i] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) goto escape;
   }
 
