Index: trunk/Ohana/src/opihi/cmd.astro/Makefile
===================================================================
--- trunk/Ohana/src/opihi/cmd.astro/Makefile	(revision 18122)
+++ trunk/Ohana/src/opihi/cmd.astro/Makefile	(revision 18718)
@@ -41,4 +41,5 @@
 $(SRC)/precess.$(ARCH).o	   \
 $(SRC)/profile.$(ARCH).o	   \
+$(SRC)/radec.$(ARCH).o	   \
 $(SRC)/region.$(ARCH).o	   \
 $(SRC)/rotcurve.$(ARCH).o	   \
Index: trunk/Ohana/src/opihi/cmd.astro/init.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.astro/init.c	(revision 18122)
+++ trunk/Ohana/src/opihi/cmd.astro/init.c	(revision 18718)
@@ -27,4 +27,5 @@
 int precess                 PROTO((int, char **));
 int profile                 PROTO((int, char **));
+int radec                   PROTO((int, char **));
 int region                  PROTO((int, char **));
 int rotcurve                PROTO((int, char **));
@@ -62,4 +63,5 @@
   {1, "precess",     precess,      "precess coordinates"},
   {1, "profile",     profile,      "radial profile at X, Y"},
+  {1, "radec",       radec,        "convert to/from radec in hms or dd"},
   {1, "region",      region,       "define sky region for plot"},
   {1, "rotcurve",    rotcurve,     "convert CO images to polar coords"},
Index: trunk/Ohana/src/opihi/cmd.astro/radec.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.astro/radec.c	(revision 18718)
+++ trunk/Ohana/src/opihi/cmd.astro/radec.c	(revision 18718)
@@ -0,0 +1,56 @@
+# include "astro.h"
+
+int radec (int argc, char **argv) {
+
+  int N, QUIET;
+  double ra, dec;
+  char ra_string[32], dec_string[32];
+
+  QUIET = FALSE;
+  if ((N = get_argument (argc, argv, "-q"))) {
+    QUIET = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+  if ((N = get_argument (argc, argv, "-quiet"))) {
+    QUIET = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+
+  if (argc != 4) {
+    gprint (GP_ERR, "USAGE:  radec (-hh | -hms) RA DEC [-q | -quiet]\n");
+    gprint (GP_ERR, "   convert to decimal (-hh) or sexigesimal (-hms)\n");
+    gprint (GP_ERR, "   output goes to $RA, $DEC\n");
+    return (FALSE);
+  }
+
+  if (strcmp (argv[1], "-hh") && strcmp (argv[1], "-hms")) {
+    gprint (GP_ERR, "USAGE:  radec (-hh | -hms) RA DEC [-q | -quiet]\n");
+    gprint (GP_ERR, "   convert to decimal (-hh) or sexigesimal (-hms)\n");
+    gprint (GP_ERR, "   output goes to $RA, $DEC\n");
+    return (FALSE);
+  }    
+
+  if (!ohana_str_to_radec (&ra, &dec, argv[2], argv[3])) {
+    return (FALSE);
+  }
+
+  if (!strcmp (argv[1], "-hh")) {
+    set_variable ("RA", ra);
+    set_variable ("DEC", dec);
+    if (!QUIET) {
+      gprint (GP_LOG, "%10.6f %10.6f\n", ra, dec);
+    }
+    return (TRUE);
+  }
+
+  // convert to hms, dms
+  hms_format (ra_string, ra/15.0);
+  hms_format (dec_string, dec);
+
+  set_str_variable ("RA", ra_string);
+  set_str_variable ("DEC", dec_string);
+  if (!QUIET) {
+    gprint (GP_LOG, "%s %s\n", ra_string, dec_string);
+  }
+  return (TRUE);
+}  
