From c65a5b7ba0a899aa6c322f38dd6f1faaf2071246 Mon Sep 17 00:00:00 2001 From: Emmanuel Heriberto Oceguera Conchas <e.oceguera@gmx.de> Date: Mon, 24 Oct 2022 14:25:48 +0200 Subject: [PATCH] function plotEbvCube has been added --- netCDF_visualizer_funtionality.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/netCDF_visualizer_funtionality.py b/netCDF_visualizer_funtionality.py index d7817bd..95dc84c 100644 --- a/netCDF_visualizer_funtionality.py +++ b/netCDF_visualizer_funtionality.py @@ -82,7 +82,7 @@ class maskAndFuntionality (BASE, WIDGET): self.btn_remove.clicked.connect(self.removePath) self.btn_load.clicked.connect(self.loadNetCDF) self.btn_remove_sel.clicked.connect(self.removeSelection) - #self.tree_data.itemClicked.connect(self.onItemClicked) + self.bt_plot.clicked.connect(self.plotEbvCube) """Here is the place for set stzlesheet""" #self.btn_plot.setStyleSheet("backgrou") @@ -195,6 +195,21 @@ class maskAndFuntionality (BASE, WIDGET): #remove the path from the text space whe the file is loaded self.text_set.clear() - # def onItemClicked(self, item, col): - # """This function plot the ebv""" + def plotEbvCube(self): + """This function plots the EBV cube if the user select the EBV cube""" + #we get the selected item from the tree widget + item = self.tree_data.selectedItems() + #we get the name of the selected item + name = item[0].text(0) + #we get the path of the netCDF file + path = self.text_set.text() + #we load the netCDF file + ncFile = nc.Dataset(path, 'r', format='NETCDF4') + #we get the EBV cube + ebvCube = ncFile.variables[name][:] + #we plot the EBV cube + plt.imshow(ebvCube) + plt.show() + #we close the netCDF file + ncFile.close() -- GitLab