diff --git a/netCDF_visualizer_funtionality.py b/netCDF_visualizer_funtionality.py index 0f4ba93d6e360860f24445c388ba397b77e57d09..adfd6c8981e0c23ab60fdb9282c8ae051ceb4cfb 100644 --- a/netCDF_visualizer_funtionality.py +++ b/netCDF_visualizer_funtionality.py @@ -109,9 +109,9 @@ class maskAndFuntionality (BASE, WIDGET): def removeSelection(self): """this function remove the selection in the tree widget""" - #remove the selection in the tree widget - self.tree_data.clearSelection() - + #we remmove the selectec TopLevelItems from the tree widget + for item in self.tree_data.selectedItems(): + self.tree_data.takeTopLevelItem(self.tree_data.indexOfTopLevelItem(item)) def loadNetCDF(self): @@ -134,27 +134,64 @@ class maskAndFuntionality (BASE, WIDGET): ncFileVariablesName = list(ncFile.variables.keys()) #we get the groups of the file ncFileGroupsName = list(ncFile.groups.keys()) + #we set the top of the tree that it is the name od the file self.tree_data.addTopLevelItem(top_level) - """we shoe the variables of the file in the QTreeWidgetite""" + """we show the variables of the file in the QTreeWidgetite""" for i in range(len(ncFileVariablesName)): child = QTreeWidgetItem([ncFileVariablesName[i]]) top_level.addChild(child) - + + #we show the groups of the file in the QTreeWidgetite for i in range(len(ncFileGroupsName)): child = QTreeWidgetItem([ncFileGroupsName[i]]) top_level.addChild(child) - + #we get the groups of the groups + ncFileGroupsName2 = list(ncFile.groups[ncFileGroupsName[i]].groups.keys()) + #we show the groups of the groups in the QTreeWidgetite + for j in range(len(ncFileGroupsName2)): + child2 = QTreeWidgetItem([ncFileGroupsName2[j]]) + child.addChild(child2) + #we get the variables of the groups of the groups + ncFileVariablesName2 = list(ncFile.groups[ncFileGroupsName[i]].groups[ncFileGroupsName2[j]].variables.keys()) + #we show the variables of the groups of the groups in the QTreeWidgetite + for k in range(len(ncFileVariablesName2)): + child3 = QTreeWidgetItem([ncFileVariablesName2[k]]) + child2.addChild(child3) + #we get the variables of the groups + ncFileGroupsVariablesName = list(ncFile.groups[ncFileGroupsName[i]].variables.keys()) + #we show the variables of the groups in the QTreeWidgetite + for j in range(len(ncFileGroupsVariablesName)): + child2 = QTreeWidgetItem([ncFileGroupsVariablesName[j], ncFileGroupsVariablesLongName[j]]) + child.addChild(child2) + #we get the long name of the variables + ncFileGroupsVariablesLongName = list(ncFile.groups[ncFileGroupsName[i]].variables[ncFileGroupsVariablesName[j]].long_name) + #we show the long name of the variables in the QTreeWidgetite + for j in range(len(ncFileGroupsVariablesLongName)): + child2 = QTreeWidgetItem([ncFileGroupsVariablesLongName[j]]) + child.addChild(child2) + + + + + + + # #we set the dimensions in the ListWidget # self.column_data.addItems(ncFileDimensions) # #we set the variables in the ListWidget # self.column_data.addItems(ncFileVariables) - + - + #we close the netCDF file ncFile.close() - + #remove the path from the text space + self.text_set.clear() + + def plotNetCDF(self): + """This function plots the netCDF file""" +