Index: /trunk/Ohana/src/opihi/cmd.astro/csystem.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.astro/csystem.c	(revision 8129)
+++ /trunk/Ohana/src/opihi/cmd.astro/csystem.c	(revision 8130)
@@ -5,5 +5,5 @@
   /* USAGE: csystem [C/G/E/H] [C/G/E/H] [epoch] */
   int i;
-  double X, Y, Xo, xo, phi, T;
+  double Xin, Yin, X, Y, Xo, xo, phi, T;
   double sin_x, sin_y, cos_x, cos_y;
   float *x, *y;
@@ -86,4 +86,25 @@
   Xo *= RAD_DEG;
 
+  if (SelectScalar (argv[3], &X)) {
+      if (!SelectScalar (argv[4], &Y)) return (FALSE);
+      
+      X *= RAD_DEG;
+      Y *= RAD_DEG;
+
+      sin_y = cos(Y)*sin(X - Xo)*sin(phi) + sin(Y)*cos(phi);
+      cos_y = sqrt (1 - sin_y*sin_y);
+      sin_x = (cos(Y)*sin(X - Xo)*cos(phi) - sin(Y)*sin(phi)) /  cos_y;
+      cos_x = cos(Y)*cos(X - Xo) / cos_y;
+      
+      X = (DEG_RAD * atan2 (sin_x, cos_x) + xo + 360);
+      
+      while (X >= 360.0)
+	  X -= 360;
+      Y = DEG_RAD * atan2 (sin_y, cos_y);
+
+      gprint (GP_LOG, "%10.6f %10.6f\n", X, Y);
+      return (TRUE);
+  }
+
   /* find vectors */
   if ((xvec = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE);
