Index: trunk/Ohana/src/opihi/cmd.data/Makefile
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/Makefile	(revision 39534)
+++ trunk/Ohana/src/opihi/cmd.data/Makefile	(revision 39558)
@@ -149,4 +149,5 @@
 $(SRC)/tvcontour.$(ARCH).o	   \
 $(SRC)/tvgrid.$(ARCH).o	           \
+$(SRC)/type.$(ARCH).o		   \
 $(SRC)/uniq.$(ARCH).o		   \
 $(SRC)/unsign.$(ARCH).o	           \
Index: trunk/Ohana/src/opihi/cmd.data/init.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/init.c	(revision 39534)
+++ trunk/Ohana/src/opihi/cmd.data/init.c	(revision 39558)
@@ -137,4 +137,5 @@
 int tvcontour        PROTO((int, char **));
 int tvgrid           PROTO((int, char **));
+int opihi_type             PROTO((int, char **));
 int uniq             PROTO((int, char **));
 int unsign           PROTO((int, char **));
@@ -314,4 +315,5 @@
   {1, "tvcontour",    tvcontour,        "send contour to image overlay"},
   {1, "tvgrid",       tvgrid,           "RA/DEC grid on an image"},
+  {1, "type",         opihi_type,       "get scalar/vector/matrix type information"},
   {1, "ungridify",    ungridify,        "convert image region to vector triplet"},
   {1, "uniq",         uniq,             "create a uniq vector subset from a vector"},
Index: trunk/Ohana/src/opihi/cmd.data/type.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/type.c	(revision 39558)
+++ trunk/Ohana/src/opihi/cmd.data/type.c	(revision 39558)
@@ -0,0 +1,56 @@
+# include "data.h"
+
+int opihi_type (int argc, char **argv) {
+  
+  int N;
+
+  int SCALAR = FALSE;
+  if ((N = get_argument (argc, argv, "-scalar"))) {
+    SCALAR = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+
+  char *varName = NULL;
+  if ((N = get_argument (argc, argv, "-var"))) {
+    remove_argument (N, &argc, argv);
+    varName = strcreate (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+
+  if (argc != 2) goto usage;
+
+  char result[16]; memset (result, 0, 16);
+
+  if (SCALAR) {
+    if (IsScalar (argv[1])) {
+      strcpy (result, "found");
+    } else {
+      strcpy (result, "none");
+    }
+    goto got_result;
+  }
+
+  Vector *vec = NULL;
+  Buffer *buf = NULL;
+  if ((vec = SelectVector (argv[1], OLDVECTOR, FALSE)) != NULL) {
+    if (vec->type == OPIHI_FLT) { strcpy (result, "float"); goto got_result; }
+    if (vec->type == OPIHI_INT) { strcpy (result, "int");   goto got_result; }
+    myAbort ("impossible");
+  }
+  if ((buf = SelectBuffer (argv[1], OLDBUFFER, FALSE)) != NULL) { strcpy (result, "matrix"); goto got_result; }
+  strcpy (result, "none");
+
+got_result:
+  if (varName) {
+    set_str_variable (varName, result);
+  } else {
+    gprint (GP_LOG, "%s\n", result);
+  }
+  return TRUE;
+
+usage:
+  gprint (GP_ERR, "SYNTAX: type (vector/buffer) [-var value] [-scalar]\n");
+  gprint (GP_ERR, "  returns 'none', 'float', 'int' for vector types, 'matrix' for buffer / image / matrix\n");
+  gprint (GP_ERR, "  returns 'none', 'found' for scalar types if -scalar is selected\n");
+  return (FALSE);
+}
