From 77a4b779a87a7d6e385d113ba5d7c94bfedd7782 Mon Sep 17 00:00:00 2001
From: Oceguera Conchas <no67wuwu@idiv.de>
Date: Fri, 21 Oct 2022 15:52:26 +0200
Subject: [PATCH] the groups od the groups and the attibutes has been added

---
 netCDF_visualizer_funtionality.py | 33 ++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/netCDF_visualizer_funtionality.py b/netCDF_visualizer_funtionality.py
index adfd6c8..d9927f8 100644
--- a/netCDF_visualizer_funtionality.py
+++ b/netCDF_visualizer_funtionality.py
@@ -139,39 +139,44 @@ class maskAndFuntionality (BASE, WIDGET):
             #we set the top of the tree that it is the name od the file
             self.tree_data.addTopLevelItem(top_level)
             
-            """we show the variables of the file in the QTreeWidgetite"""
+            #we get the variables of the file and show then as well as the long name in the tree
             for i in range(len(ncFileVariablesName)):
-                child = QTreeWidgetItem([ncFileVariablesName[i]])
+                child = QTreeWidgetItem([ncFileVariablesName[i], ncFile.variables[ncFileVariablesName[i]].long_name])
                 top_level.addChild(child)
         
             #we show the groups of the file in the QTreeWidgetite
             for i in range(len(ncFileGroupsName)):
-                child = QTreeWidgetItem([ncFileGroupsName[i]])
+                child = QTreeWidgetItem([ncFileGroupsName[i], 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]])
+                    child2 = QTreeWidgetItem([ncFileGroupsName2[j], 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
+                   
+                    #we show the variables of the groups of the groups in the QTreeWidgetite an set the lon name of the variables
                     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
+                
+            
+                #we show the variables of the groups in the QTreeWidgetite and set the long name of the variables
                 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)
+                    longNameVariables = ncFile.groups[ncFileGroupsName[i]].variables[ncFileGroupsVariablesName[j]].long_name
+                    child4 = QTreeWidgetItem([ncFileGroupsVariablesName[j],longNameVariables])
+                    child.addChild(child4)
+                    
+
                     
 
 
-- 
GitLab