From 69a576c688be7151e61c90324e9260461179d4e9 Mon Sep 17 00:00:00 2001
From: Eva Schiffer <evas@ssec.wisc.edu>
Date: Fri, 23 Jan 2015 14:15:33 -0600
Subject: [PATCH] bug fix to stop the gui from crashing on 1D variables

---
 pyglance/glance/gui_view.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/pyglance/glance/gui_view.py b/pyglance/glance/gui_view.py
index ad3c987..255fc47 100644
--- a/pyglance/glance/gui_view.py
+++ b/pyglance/glance/gui_view.py
@@ -1136,14 +1136,22 @@ class NumpyArrayTableModel (QtCore.QAbstractTableModel) :
         return self.np_array.shape[0]
 
     def columnCount(self, parent=None):
-        return self.np_array.shape[1]
+        to_return = 1
+        if len(self.np_array.shape) > 1 :
+            to_return = self.np_array.shape[1]
+
+        return to_return
 
     def data(self, index, role=QtCore.Qt.DisplayRole):
         if index.isValid():
             if role == QtCore.Qt.DisplayRole:
                 row = index.row()
                 col = index.column()
-                return QtCore.QVariant("%.5f"%self.np_array[row, col])
+                if len(self.np_array.shape) > 1 :
+                    return QtCore.QVariant("%.5f"%self.np_array[row, col])
+                else :
+                    return QtCore.QVariant("%.5f"%self.np_array[row])
+
         return QtCore.QVariant()
 
 class RawDataDisplayWindow (QtGui.QWidget) :
-- 
GitLab