Skip to content
Snippets Groups Projects
Commit 20cffd67 authored by Emmanuel Heriberto Oceguera Conchas's avatar Emmanuel Heriberto Oceguera Conchas
Browse files

modul netCDF4 does not work

parent f0e01648
No related branches found
No related tags found
No related merge requests found
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>771</width> <width>389</width>
<height>835</height> <height>518</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
......
...@@ -135,22 +135,24 @@ class netCDFVisualizer: ...@@ -135,22 +135,24 @@ class netCDFVisualizer:
#when we click the plugin in QGIS the plugin will be loaded #when we click the plugin in QGIS the plugin will be loaded
def initGui(self): def initGui(self):
"""Create the menu entries and toolbar icons inside the QGIS GUI.""" """Create the menu entries and toolbar icons inside the QGIS GUI."""
icon_path = ':/plugins/netCDFVisualizer/icon.png' icon_path = ':/plugins/netCDFVisualizer/adventure.png'
self.add_action( self.add_action(
icon_path, icon_path,
text=self.tr(u'netCDFVisualizer'), text=self.tr(u'netCDFVisualizer'),
callback=self.callMask, callback=self.callMask,
parent=self.iface.mainWindow()) parent=self.iface.mainWindow())
#when we close the plugin in QGIS the plugin will be unloaded #when we close the plugin in QGIS the plugin will be unloaded
def unload(self): def unload(self):
#we remove the menu item """Removes the plugin menu item and icon from QGIS GUI."""
self.iface.removePluginMenu('netCDFVisualizer', self.pluginButton) for action in self.actions:
#we remove the menu item self.iface.removePluginMenu(
self.iface.removeToolBarIcon(self.pluginButton) self.tr(u'&netCDFVisualizer'),
action)
self.iface.removeToolBarIcon(action)
else :
self.toolbar.removeAction(action)
#we create a function to call the mask #we create a function to call the mask
def callMask(self): def callMask(self):
......
...@@ -34,7 +34,8 @@ import os ...@@ -34,7 +34,8 @@ import os
#to import general tools from QGIS we need the qgis.core module #to import general tools from QGIS we need the qgis.core module
from qgis.core import * from qgis.core import *
#for loading the netCDF files we need the netCDF4 module #for loading the netCDF files we need the netCDF4 module
import netCDF4 as nc
from netCDF4 import Dataset
#we create the path to the ui file #we create the path to the ui file
#Path to the Ordner where the ui file is #Path to the Ordner where the ui file is
ncvPath = os.path.dirname(__file__) #the comand dirname gives the path to the directory where the file is ncvPath = os.path.dirname(__file__) #the comand dirname gives the path to the directory where the file is
...@@ -58,6 +59,8 @@ class maskAndFuntionality (BASE, WIDGET): ...@@ -58,6 +59,8 @@ class maskAndFuntionality (BASE, WIDGET):
""" Here is the place for the Clicked Signal""" """ Here is the place for the Clicked Signal"""
self.btn_closePlugin.clicked.connect(self.closePlugin) self.btn_closePlugin.clicked.connect(self.closePlugin)
self.btn_inputFile.clicked.connect(self.importData) self.btn_inputFile.clicked.connect(self.importData)
self.btn_remove.clicked.connect(self.removePath)
self.btn_load.clicked.connect(self.loadNetCDF)
def closePlugin(self): def closePlugin(self):
...@@ -77,6 +80,20 @@ class maskAndFuntionality (BASE, WIDGET): ...@@ -77,6 +80,20 @@ class maskAndFuntionality (BASE, WIDGET):
#we remove the path from the text space #we remove the path from the text space
self.text_set.clear() self.text_set.clear()
def loadNetCDF(self):
"""This function loads the netCDF file"""
#we get the path from the text space
path = self.text_set.text()
#we load the netCDF file
self.nc = Dataset(path, 'r', format='NETCDF4')
#we get the name of the variables
self.variables = self.nc.variables.keys()
#we set the name of the variables in the combo box
self.txt_tab_dataSet.addItems(self.variables)
#we get the name of the dimensions
self.dimensions = self.nc.dimensions.keys()
#we set the name of the dimensions in the combo box
self.txt_tab_dataSet.addItems(self.dimensions)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment