From 7b272b63c0faba51c6729b4f55940374385014a2 Mon Sep 17 00:00:00 2001 From: Eva Schiffer <evas@ssec.wisc.edu> Date: Mon, 8 Nov 2021 13:05:01 -0600 Subject: [PATCH] check if we have non-2D data when making a 2D plot --- pyglance/glance/gui_figuremanager.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyglance/glance/gui_figuremanager.py b/pyglance/glance/gui_figuremanager.py index d45eab8..4c79358 100644 --- a/pyglance/glance/gui_figuremanager.py +++ b/pyglance/glance/gui_figuremanager.py @@ -465,6 +465,13 @@ class GlanceGUIFigures (object) : raise ValueError(NO_DATA_MESSAGE) if dataForm == SIMPLE_2D : + + # double check that our data is a shape we can handle for this type of plot + if len(data_object_to_use.data.shape) != 2 : + raise ValueError("Two dimensional data is required for this plot type. " + "The provided variable data is " + + str(data_object_to_use.data.shape) + " shaped.") + if plotAsRGB : figures.create_raw_image_plot(data_object_to_use.data, "RGB image in File " + file_char_to_use) else : -- GitLab