Index: /trunk/Ohana/src/opihi/cmd.astro/cgrid.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.astro/cgrid.c	(revision 41321)
+++ /trunk/Ohana/src/opihi/cmd.astro/cgrid.c	(revision 41322)
@@ -83,4 +83,7 @@
   Graphdata graphmode;
 
+  if ((N = get_argument (argc, argv, "-h"))) goto usage;
+  if ((N = get_argument (argc, argv, "--help"))) goto usage;
+
   RAbyHour = FALSE;
   if ((N = get_argument (argc, argv, "-ra-by-hour"))) {
@@ -151,8 +154,5 @@
   if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
 
-  if (argc != 1) {
-    gprint (GP_ERR, "USAGE: cgrid [style] [-ra-by-hour] [-labels]\n");
-    return (FALSE);
-  }
+  if (argc != 1) goto usage;
 
   /* are we plotting one of the poles? */
@@ -346,3 +346,24 @@
   return (TRUE);
 
+ usage:
+
+  gprint (GP_ERR, "USAGE: cgrid [style] [options]\n");
+  gprint (GP_ERR, "  options:\n");
+  gprint (GP_ERR, "  -h, --help: show this list\n");
+  gprint (GP_ERR, "  -ra-by-hour : RA grid lines will be space on rounded hour lines (default is degrees)\n");
+  gprint (GP_ERR, "  -labels : add RA & dec coordinates\n");
+  gprint (GP_ERR, "  -major-spacing : grid lines drawn at major tickmarks, not minor tickmarks\n");
+  gprint (GP_ERR, "  -ra-spacing : specify size of RA grid steps in degrees (ignores -ra-by-hour)\n");
+  gprint (GP_ERR, "  -dec-spacing : specify size of dec grid steps in degrees\n");
+  gprint (GP_ERR, "  -justify-ra : choose how RA labels are justified (see below)\n");
+  gprint (GP_ERR, "  -justify-dec : choose how dec labels are justified (see below)\n");
+  gprint (GP_ERR, "  -label-ra : RA coordinate of the Dec-line labels\n");
+  gprint (GP_ERR, "  -label-dec : Dec coordinate of the RA-line labels\n");
+  gprint (GP_ERR, "  -label-color : color for the labels (independent of grid lines)\n");
+  gprint (GP_ERR, "  text justification: text is justified horizontally and vertically based on the following numbers:\n");
+  gprint (GP_ERR, "   6 7 8\n");
+  gprint (GP_ERR, "   3 4 5\n");
+  gprint (GP_ERR, "   0 1 2\n");
+  return (FALSE);
 }
+
Index: /trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c	(revision 41321)
+++ /trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c	(revision 41322)
@@ -11,4 +11,17 @@
     remove_argument (N, &argc, argv);
     if ((mvec = SelectVector (argv[N], ANYVECTOR, TRUE)) == NULL) return (FALSE);
+    remove_argument (N, &argc, argv);
+  }
+
+  Vector *WxOutV = NULL; // mask vector
+  if ((N = get_argument (argc, argv, "-Wxvec"))) {
+    remove_argument (N, &argc, argv);
+    if ((WxOutV = SelectVector (argv[N], ANYVECTOR, TRUE)) == NULL) return (FALSE);
+    remove_argument (N, &argc, argv);
+  }
+  Vector *WyOutV = NULL; // mask vector
+  if ((N = get_argument (argc, argv, "-Wyvec"))) {
+    remove_argument (N, &argc, argv);
+    if ((WyOutV = SelectVector (argv[N], ANYVECTOR, TRUE)) == NULL) return (FALSE);
     remove_argument (N, &argc, argv);
   }
@@ -101,4 +114,13 @@
       mask = mvec->elements.Int;
     }
+  }
+
+  if (WxOutV) {
+    ResetVector (WxOutV, OPIHI_FLT, Ntotal);
+    for (i = 0; i < Ntotal; i++) { WxOutV->elements.Flt[i] = NAN; }
+  }
+  if (WyOutV) {
+    ResetVector (WyOutV, OPIHI_FLT, Ntotal);
+    for (i = 0; i < Ntotal; i++) { WyOutV->elements.Flt[i] = NAN; }
   }
 
@@ -169,4 +191,20 @@
 	}
       }
+    }
+  }
+  if (WxOutV) {
+    // save the calculated weights
+    for (i = 0; i < fitdata.Npts; i++) {
+      // fitdata only includes the previously unmasked points
+      int n = fitdata.index[i];
+      WxOutV->elements.Flt[n] = fitdata.Wx[i];
+    }
+  }
+  if (WyOutV) {
+    // save the calculated weights
+    for (i = 0; i < fitdata.Npts; i++) {
+      // fitdata only includes the previously unmasked points
+      int n = fitdata.index[i];
+      WyOutV->elements.Flt[n] = fitdata.Wy[i];
     }
   }
Index: /trunk/Ohana/src/opihi/cmd.data/Makefile
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/Makefile	(revision 41321)
+++ /trunk/Ohana/src/opihi/cmd.data/Makefile	(revision 41322)
@@ -117,4 +117,5 @@
 $(SRC)/point.$(ARCH).o		\
 $(SRC)/ps.$(ARCH).o		\
+$(SRC)/pdf.$(ARCH).o		\
 $(SRC)/print_vectors.$(ARCH).o 	\
 $(SRC)/mprint.$(ARCH).o 	\
Index: /trunk/Ohana/src/opihi/cmd.data/init.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/init.c	(revision 41321)
+++ /trunk/Ohana/src/opihi/cmd.data/init.c	(revision 41322)
@@ -103,4 +103,5 @@
 int parity           PROTO((int, char **));
 int point            PROTO((int, char **));
+int pdf              PROTO((int, char **));
 int ps               PROTO((int, char **));
 int vprint           PROTO((int, char **));
@@ -303,4 +304,5 @@
   {1, "ppm",          jpeg,             "convert display graphic to PPM"},
   {1, "ps",           ps,               "convert display to PostScript"},
+  {1, "pdf",          pdf,              "convert display to PDF"},
   {1, "print_vectors", vprint,          "print a set of vectors"},
   {1, "vprint",       vprint,           "print a set of vectors"},
