Index: /trunk/Ohana/src/libdvo/Makefile
===================================================================
--- /trunk/Ohana/src/libdvo/Makefile	(revision 27579)
+++ /trunk/Ohana/src/libdvo/Makefile	(revision 27580)
@@ -33,4 +33,5 @@
 $(DESTINC)/ps1_dev_3_defs.h \
 $(DESTINC)/ps1_v1_defs.h \
+$(DESTINC)/ps1_v2_defs.h \
 $(DESTINC)/ps1_ref_defs.h
 
@@ -68,4 +69,5 @@
 $(SRC)/dvo_convert_PS1_DEV_3.$(ARCH).o \
 $(SRC)/dvo_convert_PS1_V1.$(ARCH).o \
+$(SRC)/dvo_convert_PS1_V2.$(ARCH).o \
 $(SRC)/dvo_convert_PS1_REF.$(ARCH).o \
 $(SRC)/skyregion_io.$(ARCH).o    \
Index: /trunk/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /trunk/Ohana/src/libdvo/include/dvo.h	(revision 27579)
+++ /trunk/Ohana/src/libdvo/include/dvo.h	(revision 27580)
@@ -21,4 +21,5 @@
   DVO_FORMAT_PS1_DEV_3,
   DVO_FORMAT_PS1_V1,
+  DVO_FORMAT_PS1_V2,
   DVO_FORMAT_PS1_REF
 } DVOTableFormat;
@@ -91,22 +92,23 @@
 # define ID_IMAGE_FEW   0x0008  /* currently too few measurements for good value */
 
-/* Measure.flags values */
-// XXX replace the # defines with typedef enum
-# define ID_MEAS_NOCAL        0x0001  /* detection ignored for this analysis (photcode, time range) -- internal only */
-# define ID_MEAS_POOR_PHOTOM  0x0002  /* detection is photometry outlier					     */	  
-# define ID_MEAS_SKIP_PHOTOM  0x0004  /* detection was ignored for photometry measurement			     */	  
-# define ID_MEAS_AREA         0x0008  /* detection near image edge						     */
-# define ID_MEAS_POOR_ASTROM  0x0010  /* detection is astrometry outlier					     */	  
-# define ID_MEAS_SKIP_ASTROM  0x0020  /* detection was ignored for astrometry measurement			     */	  
-# define ID_MEAS_USED_OBJ     0x0040  /* detection was used during opdate objects				     */
-# define ID_MEAS_USED_CHIP    0x0080  /* detection was used during update chips					     */
-# define ID_MEAS_BLEND_MEAS   0x0100  /* detection is within radius of multiple objects				     */
-# define ID_MEAS_BLEND_OBJ    0x0200  /* multiple detections within radius of object				     */
-# define ID_MEAS_UNDEF_3      0x0400  /* unused									     */
-# define ID_MEAS_UNDEF_4      0x0800  /* unused									     */
-# define ID_MEAS_BLEND_MEAS_X 0x1000  /* detection is within radius of multiple objects across catalogs		     */
-# define ID_MEAS_ARTIFACT     0x2000  /* detection is thought to be non-astronomical				     */
-# define ID_MEAS_UNDEF_5      0x4000  /* unused									     */
-# define ID_MEAS_UNDEF_6      0x8000  /* unused									     */
+/* Measure.flags values -- these values are 32 bit (as of PS1_V1) */
+typedef enum {
+  ID_MEAS_NOCAL        = 0x0001,  // detection ignored for this analysis (photcode, time range) -- internal only 
+  ID_MEAS_POOR_PHOTOM  = 0x0002,  // detection is photometry outlier					     	  
+  ID_MEAS_SKIP_PHOTOM  = 0x0004,  // detection was ignored for photometry measurement			     	  
+  ID_MEAS_AREA         = 0x0008,  // detection near image edge						     
+  ID_MEAS_POOR_ASTROM  = 0x0010,  // detection is astrometry outlier					     	  
+  ID_MEAS_SKIP_ASTROM  = 0x0020,  // detection was ignored for astrometry measurement			     	  
+  ID_MEAS_USED_OBJ     = 0x0040,  // detection was used during opdate objects				     
+  ID_MEAS_USED_CHIP    = 0x0080,  // detection was used during update chips					     
+  ID_MEAS_BLEND_MEAS   = 0x0100,  // detection is within radius of multiple objects				     
+  ID_MEAS_BLEND_OBJ    = 0x0200,  // multiple detections within radius of object				     
+  ID_MEAS_UNDEF_3      = 0x0400,  // unused									     
+  ID_MEAS_UNDEF_4      = 0x0800,  // unused									     
+  ID_MEAS_BLEND_MEAS_X = 0x1000,  // detection is within radius of multiple objects across catalogs		     
+  ID_MEAS_ARTIFACT     = 0x2000,  // detection is thought to be non-astronomical				     
+  ID_MEAS_UNDEF_5      = 0x4000,  // unused									     
+  ID_MEAS_UNDEF_6      = 0x8000,  // unused									     
+} DVOMeasureFlags;
 
 // XXX we used these names previously in markstar: replace with ID_MEAS_ARTIFACT
@@ -124,18 +126,26 @@
 */
 
-/* Average.code values */
-# define ID_STAR_FEW   0x0001 /* used within relphot: skip star */
-# define ID_STAR_POOR  0x0002 /* used within relphot: skip star */
-# define ID_PROPER     0x0400 /* star with large proper motion */
-# define ID_TRANSIENT  0x1000 /* is this mutually exclusive with USNO?  */
-# define ID_VARIABLE   0x2000 /* not currently set? */
-# define ID_ASTEROID   0x2000 /* identified with an asteroid */
-# define ID_BAD_OBJECT 0x4000 /* if all measurements are bad, set this bit */
-# define ID_MOVING     0x8000
-# define ID_ROCK       0xa000 /* 0x8000 + 0x2000 */
-# define ID_GHOST      0xc001 /* 0x8000 + 0x4000 + 0x0001 */
-# define ID_TRAIL      0xc002 /* 0x8000 + 0x4000 + 0x0002 */
-# define ID_BLEED      0xc003 /* 0x8000 + 0x4000 + 0x0003 */ 
-# define ID_COSMIC     0xc004 /* 0x8000 + 0x4000 + 0x0004 */ 
+/* Average.code values -- these values are 32 bit (as of PS1_V1) */
+typedef enum {
+  ID_STAR_FEW     = 0x00000001, // used within relphot: skip star 
+  ID_STAR_POOR    = 0x00000002, // used within relphot: skip star 
+  ID_PROPER       = 0x00000400, // star with large proper motion 
+  ID_TRANSIENT    = 0x00001000, // is this mutually exclusive with USNO?  
+  ID_VARIABLE     = 0x00002000, // not currently set? 
+  ID_ASTEROID     = 0x00002000, // identified with an asteroid 
+  ID_BAD_OBJECT   = 0x00004000, // if all measurements are bad, set this bit 
+  ID_MOVING       = 0x00008000, // is a moving object
+  ID_ROCK         = 0x0000a000, // 0x8000 + 0x2000 
+  ID_GHOST        = 0x0000c001, // 0x8000 + 0x4000 + 0x0001 
+  ID_TRAIL        = 0x0000c002, // 0x8000 + 0x4000 + 0x0002 
+  ID_BLEED        = 0x0000c003, // 0x8000 + 0x4000 + 0x0003  
+  ID_COSMIC       = 0x0000c004, // 0x8000 + 0x4000 + 0x0004  
+  ID_STAR_FIT_AVE = 0x00010000, // average position fitted
+  ID_STAR_FIT_PM  = 0x00020000, // proper motion fitted
+  ID_STAR_FIT_PAR = 0x00040000, // parallax fitted
+  ID_STAR_USE_AVE = 0x00080000, // average position used (not PM or PAR)
+  ID_STAR_USE_PM  = 0x00100000, // proper motion used (not AVE or PAR)
+  ID_STAR_USE_PAR = 0x00200000, // parallax used (not AVE or PM)
+} DVOAverageFlags;
 
 /*** general dvo structures (internal use only / not IO) ***/
@@ -389,4 +399,5 @@
 # include "ps1_dev_3_defs.h"
 # include "ps1_v1_defs.h"
+# include "ps1_v2_defs.h"
 # include "ps1_ref_defs.h"
 
Index: /trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c	(revision 27580)
@@ -77,4 +77,10 @@
   } 
 
+  if (!strcmp (extname, "DVO_PHOTCODE_PS1_V2")) {
+    PhotCode_PS1_V2 *photcode_ps1_v2 = gfits_table_get_PhotCode_PS1_V2 (&db.ftable, &Ncode, &db.swapped);
+    photcode = PhotCode_PS1_V2_To_Internal (photcode_ps1_v2, Ncode);
+    free (photcode_ps1_v2);
+  } 
+
   if (!strcmp (extname, "DVO_PHOTCODE_PS1_REF")) {
     PhotCode_PS1_REF *photcode_ps1_ref = gfits_table_get_PhotCode_PS1_REF (&db.ftable, &Ncode, &db.swapped);
Index: /trunk/Ohana/src/libdvo/src/SavePhotcodesFITS.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/SavePhotcodesFITS.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/SavePhotcodesFITS.c	(revision 27580)
@@ -29,9 +29,9 @@
   // for the moment, we simply support the latest photcode format for output
   // XXX update this as needed as new formats are defined
-  PhotCode_PS1_V1 *photcode_output = PhotCode_Internal_To_PS1_V1 (table[0].code, table[0].Ncode);
+  PhotCode_PS1_V2 *photcode_output = PhotCode_Internal_To_PS1_V2 (table[0].code, table[0].Ncode);
 
   /* convert FITS format data to internal format (byteswaps & EXTNAME) */
   gfits_db_create (&db);
-  gfits_table_set_PhotCode_PS1_V1 (&db.ftable, photcode_output, table[0].Ncode);
+  gfits_table_set_PhotCode_PS1_V2 (&db.ftable, photcode_output, table[0].Ncode);
   gfits_db_save (&db);
   gfits_db_close (&db);
Index: /trunk/Ohana/src/libdvo/src/dvo_catalog.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_catalog.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_catalog.c	(revision 27580)
@@ -53,4 +53,5 @@
   if (!strcasecmp (catformat, "PS1_DEV_2"))       return (DVO_FORMAT_PS1_DEV_2);
   if (!strcasecmp (catformat, "PS1_V1"))          return (DVO_FORMAT_PS1_V1);
+  if (!strcasecmp (catformat, "PS1_V2"))          return (DVO_FORMAT_PS1_V2);
   if (!strcasecmp (catformat, "PS1_REF"))         return (DVO_FORMAT_PS1_REF);
   return (DVO_FORMAT_UNDEF);
Index: /trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 27580)
@@ -87,4 +87,5 @@
       FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
       FORMAT_CASE (PS1_V1,    PS1_V1);
+      FORMAT_CASE (PS1_V2,    PS1_V2);
       FORMAT_CASE (PS1_REF,   PS1_REF);
 
@@ -278,4 +279,5 @@
   if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_2)       gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_2");
   if (catalog[0].catformat == DVO_FORMAT_PS1_V1)          gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V1");
+  if (catalog[0].catformat == DVO_FORMAT_PS1_V2)          gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V2");
   if (catalog[0].catformat == DVO_FORMAT_PS1_REF)         gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_REF");
 
@@ -375,4 +377,5 @@
       FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
       FORMAT_CASE (PS1_V1,    PS1_V1);
+      FORMAT_CASE (PS1_V2,    PS1_V2);
       FORMAT_CASE (PS1_REF,   PS1_REF);
 
@@ -423,4 +426,5 @@
       FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
       FORMAT_CASE (PS1_V1,    PS1_V1);
+      FORMAT_CASE (PS1_V2,    PS1_V2);
       FORMAT_CASE (PS1_REF,   PS1_REF);
 
@@ -475,4 +479,5 @@
       FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
       FORMAT_CASE (PS1_V1,    PS1_V1);
+      FORMAT_CASE (PS1_V2,    PS1_V2);
       FORMAT_CASE (PS1_REF,   PS1_REF);
 
@@ -523,4 +528,5 @@
       FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
       FORMAT_CASE (PS1_V1,    PS1_V1);
+      FORMAT_CASE (PS1_V2,    PS1_V2);
       FORMAT_CASE (PS1_REF,   PS1_REF);
 
@@ -575,4 +581,5 @@
       FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
       FORMAT_CASE (PS1_V1,    PS1_V1);
+      FORMAT_CASE (PS1_V2,    PS1_V2);
       FORMAT_CASE (PS1_REF,   PS1_REF);
 
@@ -623,4 +630,5 @@
       FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
       FORMAT_CASE (PS1_V1,    PS1_V1);
+      FORMAT_CASE (PS1_V2,    PS1_V2);
       FORMAT_CASE (PS1_REF,   PS1_REF);
 
Index: /trunk/Ohana/src/libdvo/src/dvo_convert.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert.c	(revision 27580)
@@ -50,4 +50,5 @@
   CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
   CONVERT_FORMAT ("DVO_AVERAGE_PS1_V1",          PS1_V1,          PS1_V1);
+  CONVERT_FORMAT ("DVO_AVERAGE_PS1_V2",          PS1_V2,          PS1_V2);
   CONVERT_FORMAT ("DVO_AVERAGE_PS1_REF",         PS1_REF,         PS1_REF);
 # undef CONVERT_FORMAT
@@ -82,4 +83,5 @@
       FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
       FORMAT_CASE (PS1_V1,          PS1_V1);
+      FORMAT_CASE (PS1_V2,          PS1_V2);
       FORMAT_CASE (PS1_REF,         PS1_REF);
 # undef FORMAT_CASE
@@ -127,4 +129,5 @@
   CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
   CONVERT_FORMAT ("DVO_MEASURE_PS1_V1",          PS1_V1,          PS1_V1);
+  CONVERT_FORMAT ("DVO_MEASURE_PS1_V2",          PS1_V2,          PS1_V2);
   CONVERT_FORMAT ("DVO_MEASURE_PS1_REF",         PS1_REF,         PS1_REF);
 # undef CONVERT_FORMAT
@@ -159,4 +162,5 @@
       FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
       FORMAT_CASE (PS1_V1,          PS1_V1);
+      FORMAT_CASE (PS1_V2,          PS1_V2);
       FORMAT_CASE (PS1_REF,         PS1_REF);
 # undef FORMAT_CASE
@@ -204,4 +208,5 @@
   CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
   CONVERT_FORMAT ("DVO_SECFILT_PS1_V1",          PS1_V1,          PS1_V1);
+  CONVERT_FORMAT ("DVO_SECFILT_PS1_V2",          PS1_V2,          PS1_V2);
   CONVERT_FORMAT ("DVO_SECFILT_PS1_REF",         PS1_REF,         PS1_REF);
 # undef CONVERT_FORMAT
@@ -236,4 +241,5 @@
       FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
       FORMAT_CASE (PS1_V1,          PS1_V1);
+      FORMAT_CASE (PS1_V2,          PS1_V2);
       FORMAT_CASE (PS1_REF,         PS1_REF);
 # undef FORMAT_CASE
@@ -301,8 +307,6 @@
   CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
   CONVERT_FORMAT ("DVO_IMAGE_PS1_V1",          PS1_V1,          PS1_V1);
+  CONVERT_FORMAT ("DVO_IMAGE_PS1_V2",          PS1_V2,          PS1_V2);
   CONVERT_FORMAT ("DVO_IMAGE_PS1_REF",         PS1_REF,         PS1_REF);
-
-  // XXX Not sure this was ever actually used -- it was not complete...
-  // CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_3",       PS1_DEV_3,       PS1_DEV_3);
 
 # undef CONVERT_FORMAT
@@ -340,8 +344,7 @@
       FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
       FORMAT_CASE (PS1_V1,          PS1_V1);
+      FORMAT_CASE (PS1_V2,          PS1_V2);
       FORMAT_CASE (PS1_REF,         PS1_REF);
 
-      // XXX not sure this was actually used: it was incomplete
-      // FORMAT_CASE (PS1_DEV_3,       PS1_DEV_3);
 # undef FORMAT_CASE
 
@@ -394,8 +397,6 @@
       FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
       FORMAT_CASE (PS1_V1,          PS1_V1);
+      FORMAT_CASE (PS1_V2,          PS1_V2);
       FORMAT_CASE (PS1_REF,         PS1_REF);
-
-      // XXX not sure this was used, it was incomplete
-      // FORMAT_CASE (PS1_DEV_3,       PS1_DEV_3);
 
 # undef FORMAT_CASE
Index: /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c	(revision 27580)
@@ -140,5 +140,9 @@
     // changed or added for PS1_V1
     out[i].flags    	 = in[i].code;   
-    out[i].ChiSq       	 = 0.0;
+    out[i].ChiSqAve    	 = NAN;
+    out[i].ChiSqPM    	 = NAN;
+    out[i].ChiSqPar    	 = NAN;
+    out[i].Tmean    	 = 0;
+    out[i].Trange   	 = 0;
     out[i].Npos       	 = 0.0;
     out[i].extID 	 = 0;
@@ -199,4 +203,7 @@
     out[i].M_20  = 0;      
     out[i].M_80  = 0;      
+
+    // changed or added for PS1_V2
+    out[i].flags = 0;
  }
   return (out);
@@ -279,4 +286,9 @@
     out[i].flags	    = in[i].code;
     out[i].parentID	    = 0;
+
+    // changed or added for PS1_V2
+    out[i].RAo  	    = NAN;
+    out[i].DECo  	    = NAN;
+    out[i].Radius  	    = NAN;
   }
   return (out);
Index: /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c	(revision 27580)
@@ -134,5 +134,9 @@
     // changed or added for PS1_V1
     out[i].flags    	 = in[i].code;   
-    out[i].ChiSq       	 = 0.0;
+    out[i].ChiSqAve    	 = NAN;
+    out[i].ChiSqPM    	 = NAN;
+    out[i].ChiSqPar    	 = NAN;
+    out[i].Tmean    	 = 0;
+    out[i].Trange   	 = 0;
     out[i].Npos       	 = 0.0;
     out[i].extID 	 = 0;
@@ -193,4 +197,7 @@
     out[i].M_20  = 0;      
     out[i].M_80  = 0;      
+
+    // changed or added for PS1_V2
+    out[i].flags = 0;
  }
   return (out);
@@ -271,4 +278,9 @@
     out[i].flags	    = in[i].code;
     out[i].parentID	    = 0;
+
+    // changed or added for PS1_V2
+    out[i].RAo  	    = NAN;
+    out[i].DECo  	    = NAN;
+    out[i].Radius  	    = NAN;
   }
   return (out);
@@ -302,4 +314,5 @@
     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;
Index: /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c	(revision 27580)
@@ -98,5 +98,9 @@
     out[i].dP       	 = NAN;
     out[i].Xp       	 = NAN_S_SHORT;
-    out[i].ChiSq       	 = NAN;
+    out[i].ChiSqAve    	 = NAN;
+    out[i].ChiSqPM    	 = NAN;
+    out[i].ChiSqPar    	 = NAN;
+    out[i].Tmean    	 = 0;
+    out[i].Trange   	 = 0;
     out[i].Npos       	 = 0;
     out[i].Nmeasure      = in[i].Nmeasure;     
@@ -153,4 +157,7 @@
     out[i].M_20  = 0;
     out[i].M_80  = 0;
+
+    // changed or added for PS1_V2
+    out[i].flags = 0;
  }
   return (out);
@@ -226,4 +233,9 @@
     out[i].Mxyyy	    = in[i].Mxyyy;
     out[i].Myyyy	    = in[i].Myyyy;
+
+    // changed or added for PS1_V2
+    out[i].RAo  	    = NAN;
+    out[i].DECo  	    = NAN;
+    out[i].Radius  	    = NAN;
   }
   return (out);
Index: /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c	(revision 27580)
@@ -130,5 +130,9 @@
     out[i].dP       	 = in[i].dP;
     out[i].Xp       	 = in[i].Xp;     
-    out[i].ChiSq       	 = in[i].ChiSq;     
+    out[i].ChiSqAve    	 = in[i].ChiSq;     
+    out[i].ChiSqPM    	 = NAN;
+    out[i].ChiSqPar    	 = NAN;
+    out[i].Tmean    	 = 0;
+    out[i].Trange    	 = 0;
     out[i].Npos       	 = in[i].Npos;     
     out[i].Nmeasure      = in[i].Nmeasure;     
@@ -166,5 +170,5 @@
     out[i].dP       	 = in[i].dP;
     out[i].Xp       	 = in[i].Xp;     
-    out[i].ChiSq       	 = in[i].ChiSq;     
+    out[i].ChiSq    	 = in[i].ChiSqAve;     
     out[i].Npos       	 = in[i].Npos;     
     out[i].Nmeasure      = in[i].Nmeasure;     
@@ -197,4 +201,7 @@
     out[i].M_20  = in[i].M_20;      
     out[i].M_80  = in[i].M_80;      
+
+    // changed or added for PS1_V2
+    out[i].flags = 0;
  }
   return (out);
@@ -275,4 +282,10 @@
     out[i].Mxyyy	    = in[i].Mxyyy;
     out[i].Myyyy	    = in[i].Myyyy;
+
+    // changed or added for PS1_V2
+    out[i].RAo  	    = NAN;
+    out[i].DECo  	    = NAN;
+    out[i].Radius  	    = NAN;
+
   }
   return (out);
@@ -306,4 +319,5 @@
     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;
Index: /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c	(revision 27580)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c	(revision 27580)
@@ -0,0 +1,431 @@
+# include <dvo.h>
+
+/* convert PS1_V2 formats to internal formats */
+
+Measure *Measure_PS1_V2_ToInternal (Measure_PS1_V2 *in, off_t Nvalues) {
+
+  off_t 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].Mcal       = in[i].Mcal;
+    out[i].Map        = in[i].Map;
+    out[i].dM         = in[i].dM;
+    out[i].dMcal      = in[i].dMcal;
+    out[i].dt         = in[i].dt;
+    out[i].airmass    = in[i].airmass;
+    out[i].az         = in[i].az;
+    out[i].Xccd       = in[i].Xccd;
+    out[i].Yccd       = in[i].Yccd;
+    out[i].Sky        = in[i].Sky;
+    out[i].dSky       = in[i].dSky;
+    out[i].t          = in[i].t;
+    out[i].t_msec     = in[i].t_msec;
+    out[i].averef     = in[i].averef;
+    out[i].detID      = in[i].detID;
+    out[i].imageID    = in[i].imageID;
+    out[i].objID      = in[i].objID;
+    out[i].catID      = in[i].catID;
+    out[i].extID      = in[i].extID;
+    out[i].psfQual    = in[i].psfQual;
+    out[i].psfChisq   = in[i].psfChisq;
+    out[i].psfNdof    = in[i].psfNdof;
+    out[i].psfNpix    = in[i].psfNpix;
+    out[i].crNsigma   = in[i].crNsigma;
+    out[i].extNsigma  = in[i].extNsigma;
+    out[i].FWx 	      = in[i].FWx;
+    out[i].FWy 	      = in[i].FWy;
+    out[i].theta      = in[i].theta;
+    out[i].Mxx 	      = in[i].Mxx;
+    out[i].Mxy 	      = in[i].Mxy;
+    out[i].Myy 	      = in[i].Myy;
+    out[i].dXccd      = in[i].dXccd;
+    out[i].dYccd      = in[i].dYccd;
+    out[i].posangle   = in[i].posangle;
+    out[i].pltscale   = in[i].pltscale;
+    out[i].photcode   = in[i].photcode;
+    out[i].dbFlags    = in[i].dbFlags;
+    out[i].photFlags  = in[i].photFlags;
+  }
+  return (out);
+}
+
+Measure_PS1_V2 *MeasureInternalTo_PS1_V2 (Measure *in, off_t Nvalues) {
+
+  off_t i;
+  Measure_PS1_V2 *out;
+
+  ALLOCATE (out, Measure_PS1_V2, 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].Mcal       = in[i].Mcal;
+    out[i].Map        = in[i].Map;
+    out[i].dM         = in[i].dM;
+    out[i].dMcal      = in[i].dMcal;
+    out[i].dt         = in[i].dt;
+    out[i].airmass    = in[i].airmass;
+    out[i].az         = in[i].az;
+    out[i].Xccd       = in[i].Xccd;
+    out[i].Yccd       = in[i].Yccd;
+    out[i].Sky        = in[i].Sky;
+    out[i].dSky       = in[i].dSky;
+    out[i].t          = in[i].t;
+    out[i].t_msec     = in[i].t_msec;
+    out[i].averef     = in[i].averef;
+    out[i].detID      = in[i].detID;
+    out[i].imageID    = in[i].imageID;
+    out[i].objID      = in[i].objID;
+    out[i].catID      = in[i].catID;
+    out[i].extID      = in[i].extID;
+    out[i].psfQual    = in[i].psfQual;
+    out[i].psfChisq   = in[i].psfChisq;
+    out[i].psfNdof    = in[i].psfNdof;
+    out[i].psfNpix    = in[i].psfNpix;
+    out[i].crNsigma   = in[i].crNsigma;
+    out[i].extNsigma  = in[i].extNsigma;
+    out[i].FWx 	      = in[i].FWx;
+    out[i].FWy 	      = in[i].FWy;
+    out[i].theta      = in[i].theta;
+    out[i].Mxx 	      = in[i].Mxx;
+    out[i].Mxy 	      = in[i].Mxy;
+    out[i].Myy 	      = in[i].Myy;
+    out[i].dXccd      = in[i].dXccd;
+    out[i].dYccd      = in[i].dYccd;
+    memset(out[i].pad, 0, sizeof(out[i].pad));
+    out[i].posangle   = in[i].posangle;
+    out[i].pltscale   = in[i].pltscale;
+    out[i].photcode   = in[i].photcode;
+    out[i].dbFlags    = in[i].dbFlags;
+    out[i].photFlags  = in[i].photFlags;
+  }
+  return (out);
+}
+
+// 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
+Average *Average_PS1_V2_ToInternal (Average_PS1_V2 *in, off_t Nvalues, SecFilt **primary) {
+
+  off_t 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].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].Xp       	 = in[i].Xp;     
+    out[i].ChiSqAve    	 = in[i].ChiSqAve;     
+    out[i].ChiSqPM    	 = in[i].ChiSqPM;     
+    out[i].ChiSqPar    	 = in[i].ChiSqPar;     
+    out[i].Tmean    	 = in[i].Tmean;     
+    out[i].Trange   	 = in[i].Trange;     
+    out[i].Npos       	 = in[i].Npos;     
+    out[i].Nmeasure      = in[i].Nmeasure;     
+    out[i].Nmissing      = in[i].Nmissing;     
+    out[i].Nextend       = in[i].Nextend;     
+    out[i].measureOffset = in[i].measureOffset; 
+    out[i].missingOffset = in[i].missingOffset;
+    out[i].extendOffset  = in[i].extendOffset;
+    out[i].flags     	 = in[i].flags;   
+    out[i].objID 	 = in[i].objID;
+    out[i].catID 	 = in[i].catID;
+    out[i].extID 	 = in[i].extID;
+  }
+  return (out);
+}
+
+// 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
+Average_PS1_V2 *AverageInternalTo_PS1_V2 (Average *in, off_t Nvalues, SecFilt *primary) {
+
+  off_t i;
+  Average_PS1_V2 *out;
+
+  ALLOCATE (out, Average_PS1_V2, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].R        	 = in[i].R;      
+    out[i].D        	 = in[i].D;      
+    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].Xp       	 = in[i].Xp;     
+    out[i].ChiSqAve    	 = in[i].ChiSqAve;     
+    out[i].ChiSqPM     	 = in[i].ChiSqPM;     
+    out[i].ChiSqPar   	 = in[i].ChiSqPar;     
+    out[i].Tmean    	 = in[i].Tmean;     
+    out[i].Trange   	 = in[i].Trange;     
+    out[i].Npos       	 = in[i].Npos;     
+    out[i].Nmeasure      = in[i].Nmeasure;     
+    out[i].Nmissing      = in[i].Nmissing;     
+    out[i].Nextend       = in[i].Nextend;     
+    out[i].measureOffset = in[i].measureOffset; 
+    out[i].missingOffset = in[i].missingOffset;
+    out[i].extendOffset  = in[i].extendOffset;
+    out[i].flags     	 = in[i].flags;   
+    out[i].objID 	 = in[i].objID;
+    out[i].catID 	 = in[i].catID;
+    out[i].extID 	 = in[i].extID;
+  }
+  return (out);
+}
+
+SecFilt *SecFilt_PS1_V2_ToInternal (SecFilt_PS1_V2 *in, off_t Nvalues) {
+
+  off_t 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].flags = in[i].flags;     
+    out[i].Ncode = in[i].Ncode;
+    out[i].Nused = in[i].Nused;
+    out[i].M_20  = in[i].M_20;      
+    out[i].M_80  = in[i].M_80;      
+ }
+  return (out);
+}
+
+SecFilt_PS1_V2 *SecFiltInternalTo_PS1_V2 (SecFilt *in, off_t Nvalues) {
+
+  off_t i;
+  SecFilt_PS1_V2 *out;
+
+  ALLOCATE (out, SecFilt_PS1_V2, 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].flags = in[i].flags;     
+    out[i].Ncode = in[i].Ncode;
+    out[i].Nused = in[i].Nused;
+    out[i].M_20  = in[i].M_20;      
+    out[i].M_80  = in[i].M_80;      
+  }
+  return (out);
+}
+
+Image *Image_PS1_V2_ToInternal (Image_PS1_V2 *in, off_t Nvalues) {
+
+  off_t i;
+  Image *out;
+
+  ALLOCATE (out, Image, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
+
+    strncpy (out[i].name, in[i].name, 120); // out[121], in[121]
+    out[i].name[120] = 0; // force termination
+
+    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].RAo  	    = in[i].RAo;
+    out[i].DECo  	    = in[i].DECo;
+    out[i].Radius  	    = in[i].Radius;
+
+    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].ccdnum	    = in[i].ccdnum;
+    out[i].flags	    = in[i].flags;
+    out[i].imageID	    = in[i].imageID;
+    out[i].parentID	    = in[i].parentID;
+    out[i].externID	    = in[i].externID;
+    out[i].sourceID	    = in[i].sourceID;
+
+    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);
+}
+
+Image_PS1_V2 *ImageInternalTo_PS1_V2 (Image *in, off_t Nvalues) {
+
+  off_t i;
+  Image_PS1_V2 *out;
+
+  ALLOCATE (out, Image_PS1_V2, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
+
+    strncpy (out[i].name, in[i].name, 120); // out[121], in[121]
+    out[i].name[120] = 0; // force termination
+
+    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].RAo  	    = in[i].RAo;
+    out[i].DECo  	    = in[i].DECo;
+    out[i].Radius  	    = in[i].Radius;
+
+    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].ccdnum	    = in[i].ccdnum;
+    out[i].flags	    = in[i].flags;
+    out[i].imageID	    = in[i].imageID;
+    out[i].parentID	    = in[i].parentID;
+    out[i].externID	    = in[i].externID;
+    out[i].sourceID	    = in[i].sourceID;
+
+    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);
+}
+
+PhotCode *PhotCode_PS1_V2_To_Internal (PhotCode_PS1_V2 *in, off_t Nvalues) {
+
+  off_t i;
+  PhotCode *out;
+
+  ALLOCATE (out, PhotCode, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
+    out[i].name[31] = 0; // force termination
+
+    out[i].code  = in[i].code;         
+    out[i].type  = in[i].type;         
+    out[i].C     = in[i].C;            
+    out[i].dC 	 = in[i].dC;           
+    out[i].dX 	 = in[i].dX;           
+    out[i].K  	 = in[i].K;            
+    out[i].c1 	 = in[i].c1;           
+    out[i].c2 	 = in[i].c2;           
+    out[i].equiv = in[i].equiv;        
+    out[i].Nc    = in[i].Nc;           
+    memcpy (out[i].X, in[i].X, 4*sizeof(float));            
+
+    out[i].astromErrSys      = in[i].astromErrSys;
+    out[i].astromErrScale    = in[i].astromErrScale;
+    out[i].astromErrMagScale = in[i].astromErrMagScale;
+    out[i].photomErrSys      = in[i].photomErrSys;
+
+    out[i].photomPoorMask      = in[i].photomPoorMask;
+    out[i].photomBadMask       = in[i].photomBadMask;
+    out[i].astromPoorMask      = in[i].astromPoorMask;
+    out[i].astromBadMask       = in[i].astromBadMask;
+  }
+  return (out);
+}
+
+PhotCode_PS1_V2 *PhotCode_Internal_To_PS1_V2 (PhotCode *in, off_t Nvalues) {
+
+  off_t i;
+  PhotCode_PS1_V2 *out;
+
+  ALLOCATE (out, PhotCode_PS1_V2, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
+    out[i].name[31] = 0; // force termination
+
+    out[i].code  = in[i].code;         
+    out[i].type  = in[i].type;         
+    memset(out[i].dummy, 0, sizeof(out[i].dummy));
+    out[i].C     = in[i].C;            
+    out[i].dC 	 = in[i].dC;           
+    out[i].dX 	 = in[i].dX;           
+    out[i].K  	 = in[i].K;            
+    out[i].c1 	 = in[i].c1;           
+    out[i].c2 	 = in[i].c2;           
+    out[i].equiv = in[i].equiv;        
+    out[i].Nc    = in[i].Nc;           
+    memcpy (out[i].X, in[i].X, 4*sizeof(float));            
+
+    out[i].astromErrSys      = in[i].astromErrSys;
+    out[i].astromErrScale    = in[i].astromErrScale;
+    out[i].astromErrMagScale = in[i].astromErrMagScale;
+    out[i].photomErrSys      = in[i].photomErrSys;
+
+    out[i].photomPoorMask      = in[i].photomPoorMask;
+    out[i].photomBadMask       = in[i].photomBadMask;
+    out[i].astromPoorMask      = in[i].astromPoorMask;
+    out[i].astromBadMask       = in[i].astromBadMask;
+  }
+  return (out);
+}
Index: /trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c	(revision 27580)
@@ -151,5 +151,9 @@
     // changed or added for PS1_V1
     out[i].flags    	 = in[i].code;   
-    out[i].ChiSq       	 = 0.0;
+    out[i].ChiSqAve    	 = NAN;
+    out[i].ChiSqPM    	 = NAN;
+    out[i].ChiSqPar    	 = NAN;
+    out[i].Tmean    	 = 0;
+    out[i].Trange   	 = 0;
     out[i].Npos       	 = 0.0;
     out[i].extID 	 = 0;
@@ -208,4 +212,7 @@
     out[i].M_20  = 0;      
     out[i].M_80  = 0;      
+
+    // changed or added for PS1_V2
+    out[i].flags = 0;
   }
   return (out);
@@ -292,4 +299,9 @@
     out[i].flags	    = in[i].code;
     out[i].parentID	    = 0;
+
+    // changed or added for PS1_V2
+    out[i].RAo  	    = NAN;
+    out[i].DECo  	    = NAN;
+    out[i].Radius  	    = NAN;
   }
   return (out);
Index: /trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c	(revision 27580)
@@ -143,5 +143,9 @@
     // changed or added for PS1_V1
     out[i].flags    	 = in[i].code;   
-    out[i].ChiSq       	 = 0.0;
+    out[i].ChiSqAve    	 = NAN;
+    out[i].ChiSqPM    	 = NAN;
+    out[i].ChiSqPar    	 = NAN;
+    out[i].Tmean    	 = 0;
+    out[i].Trange   	 = 0;
     out[i].Npos       	 = 0.0;
     out[i].extID 	 = 0;
@@ -201,4 +205,7 @@
     out[i].M_20  = 0;      
     out[i].M_80  = 0;      
+
+    // changed or added for PS1_V2
+    out[i].flags = 0;
   }
   return (out);
@@ -285,4 +292,9 @@
     out[i].flags	    = in[i].code;
     out[i].parentID	    = 0;
+
+    // changed or added for PS1_V2
+    out[i].RAo  	    = NAN;
+    out[i].DECo  	    = NAN;
+    out[i].Radius  	    = NAN;
   }
   return (out);
Index: /trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c	(revision 27580)
@@ -147,5 +147,9 @@
     // changed or added for PS1_V1
     out[i].flags    	 = in[i].code;   
-    out[i].ChiSq       	 = 0.0;
+    out[i].ChiSqAve    	 = NAN;
+    out[i].ChiSqPM    	 = NAN;
+    out[i].ChiSqPar    	 = NAN;
+    out[i].Tmean    	 = 0;
+    out[i].Trange   	 = 0;
     out[i].Npos       	 = 0.0;
     out[i].extID 	 = 0;
@@ -208,4 +212,7 @@
     out[i].M_20  = 0;      
     out[i].M_80  = 0;      
+
+    // changed or added for PS1_V2
+    out[i].flags = 0;
  }
   return (out);
@@ -292,4 +299,9 @@
     out[i].flags	    = in[i].code;
     out[i].parentID	    = 0;
+
+    // changed or added for PS1_V2
+    out[i].RAo  	    = NAN;
+    out[i].DECo  	    = NAN;
+    out[i].Radius  	    = NAN;
   }
   return (out);
Index: /trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 27580)
@@ -147,5 +147,9 @@
     // changed or added for PS1_V1
     out[i].flags    	 = in[i].code;   
-    out[i].ChiSq       	 = 0.0;
+    out[i].ChiSqAve    	 = NAN;
+    out[i].ChiSqPM    	 = NAN;
+    out[i].ChiSqPar    	 = NAN;
+    out[i].Tmean    	 = 0;
+    out[i].Trange    	 = 0;
     out[i].Npos       	 = 0.0;
     out[i].extID 	 = 0;
@@ -208,4 +212,7 @@
     out[i].M_20  = 0;      
     out[i].M_80  = 0;      
+
+    // changed or added for PS1_V2
+    out[i].flags = 0;
  }
   return (out);
@@ -292,4 +299,9 @@
     out[i].flags	    = in[i].code;
     out[i].parentID	    = 0;
+
+    // changed or added for PS1_V2
+    out[i].RAo  	    = NAN;
+    out[i].DECo  	    = NAN;
+    out[i].Radius  	    = NAN;
   }
   return (out);
Index: /trunk/Ohana/src/libdvo/src/dvo_image.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_image.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_image.c	(revision 27580)
@@ -207,4 +207,5 @@
   if (db[0].format == DVO_FORMAT_PS1_DEV_3)       gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_3");
   if (db[0].format == DVO_FORMAT_PS1_V1)          gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V1");
+  if (db[0].format == DVO_FORMAT_PS1_V2)          gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V2");
   if (db[0].format == DVO_FORMAT_PS1_REF)         gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_REF");
   
Index: /trunk/Ohana/src/libdvo/src/dvo_image_raw.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 27579)
+++ /trunk/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 27580)
@@ -56,4 +56,5 @@
   if (db[0].format == DVO_FORMAT_PS1_DEV_3)       ImageSize = sizeof(Image_PS1_DEV_3);
   if (db[0].format == DVO_FORMAT_PS1_V1)          ImageSize = sizeof(Image_PS1_V1);
+  if (db[0].format == DVO_FORMAT_PS1_V2)          ImageSize = sizeof(Image_PS1_V2);
   if (db[0].format == DVO_FORMAT_PS1_REF)         ImageSize = sizeof(Image_PS1_REF);
 
@@ -83,4 +84,5 @@
   if (db[0].format == DVO_FORMAT_PS1_DEV_3)       gfits_table_mkheader_Image_PS1_DEV_3 (&db[0].theader);
   if (db[0].format == DVO_FORMAT_PS1_V1)          gfits_table_mkheader_Image_PS1_V1 (&db[0].theader);
+  if (db[0].format == DVO_FORMAT_PS1_V2)          gfits_table_mkheader_Image_PS1_V2 (&db[0].theader);
   if (db[0].format == DVO_FORMAT_PS1_REF)         gfits_table_mkheader_Image_PS1_REF (&db[0].theader);
     
