diff --git a/netCDF_visualizer.py b/netCDF_visualizer.py index 573f0603278156910333c93b9cac00885d9d1504..d000004c508cf995ba481a71f36b64550bfd39e9 100644 --- a/netCDF_visualizer.py +++ b/netCDF_visualizer.py @@ -26,13 +26,13 @@ from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * - #import everthing from the netCDF_visualization_funtionality.py file from .netCDF_visualizer_funtionality import * - #we write a class, Plugins is a class import os + + class netCDFVisualizer: """This is a class for the netCDFVisualizer Plugin""" #we set that we need the iface to build something with the class @@ -153,7 +153,6 @@ class netCDFVisualizer: else : self.toolbar.removeAction(action) - #we create a function to call the mask def callMask(self): #we create the mask or GUI diff --git a/netCDF_visualizer_funtionality.py b/netCDF_visualizer_funtionality.py index f55b69bc64887645c5df9ee003d072ad7b11a8e5..8c61ec0498378af2c1e632f791bbe5a9ee5f5b8b 100644 --- a/netCDF_visualizer_funtionality.py +++ b/netCDF_visualizer_funtionality.py @@ -34,8 +34,26 @@ import os #to import general tools from QGIS we need the qgis.core module from qgis.core import * #for loading the netCDF files we need the netCDF4 module -import netCDF4 as nc -from netCDF4 import Dataset +try: + from pip import main as pipmain +except ImportError: + from pip._internal import main as pipmain + +try: + import netCDF4 as nc +except ImportError: + pipmain(['install', 'netCDF4']) + import netCDF4 as nc + from netCDF4 import Dataset + +#we need the matplotlib module to plot the data +#try: +# import matplotlib +#except ImportError: +# pipmain(['install', 'matplotlib']) +# import matplotlib + + #we create the path to the ui file #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