diff --git a/EBVCubeVisualizer_funtionality.py b/EBVCubeVisualizer_funtionality.py index 52b2e00385268924f50c9009b4de4ecb59587a23..b47c0b3b28d014f3f07e73a56471d7dc3acb0e35 100644 --- a/EBVCubeVisualizer_funtionality.py +++ b/EBVCubeVisualizer_funtionality.py @@ -263,33 +263,36 @@ class maskAndFuntionality (BASE, WIDGET): #when we click on the top level item we show the name of the file, title and the global attributes if self.tree_data.currentItem().parent() == None: self.text_info.clear() - self.text_info.append("File name: " + ncFileName) - self.text_info.append("Title: " + ncFileTitle) - self.text_info.append("Global attributes:") - for i in range(len(ncFileGlobalAttributes)): - self.text_info.append("-- " + ncFileGlobalAttributes[i] + ": " + str(ncFile.getncattr(ncFileGlobalAttributes[i]))) + self.text_info.append("<b><font size=4>" + "File name: " + ncFileName + "</font></b>") + self.text_info.append("<b><font size=3>" + "Title: " + ncFileTitle + "</font></b>") + self.text_info.append(" ") + self.text_info.append("<b><font size=3>" +"Global attributes: " + "</font></b>") + for i in range(len(ncFileGlobalAttributes)): + self.text_info.append("<b>" + ncFileGlobalAttributes[i] + ": " + "</b>" + str(ncFile.getncattr(ncFileGlobalAttributes[i]))) #when we click on a group we show the name of the group and the attributes of the group and if we click on a variable of the group we show the attributes of the variable elif self.tree_data.currentItem().parent().parent() == None: self.text_info.clear() - self.text_info.append("File name: " + ncFileName) - self.text_info.append("Title: " + ncFileTitle) - self.text_info.append("Group name: " + self.tree_data.currentItem().text(0)) - self.text_info.append("Long name: " + self.tree_data.currentItem().text(1)) - self.text_info.append("Attributes:") + self.text_info.append("<b><font size=4>" + "File name: " + ncFileName + "</font></b>") + self.text_info.append("<b><font size=3>" + "Title: " + ncFileTitle + "</font></b>") + self.text_info.append("<b><font size=3>" + "Group name: " + self.tree_data.currentItem().text(0) + "</font></b>") + self.text_info.append("<b><font size=3>" + "Long name: " + self.tree_data.currentItem().text(1) + "</font></b>") + self.text_info.append(" ") + self.text_info.append("<b><font size=3>" + "Attributes:" + "</font></b>") for i in range(len(ncFile.groups[self.tree_data.currentItem().text(0)].ncattrs())): - self.text_info.append("-- " + ncFile.groups[self.tree_data.currentItem().text(0)].ncattrs()[i] + ": " + str(ncFile.groups[self.tree_data.currentItem().text(0)].getncattr(ncFile.groups[self.tree_data.currentItem().text(0)].ncattrs()[i]))) + self.text_info.append("<b>" + "-- " + ncFile.groups[self.tree_data.currentItem().text(0)].ncattrs()[i] + ": " + "</b>" + str(ncFile.groups[self.tree_data.currentItem().text(0)].getncattr(ncFile.groups[self.tree_data.currentItem().text(0)].ncattrs()[i]))) #when we click on a variable of the group and the attributes of the varibales else: - self.text_info.append("File name: " + ncFileName) - self.text_info.append("Title: " + ncFileTitle) - self.text_info.append("Variable name: " + self.tree_data.currentItem().text(0)) - self.text_info.append("Long name: " + self.tree_data.currentItem().text(1)) - self.text_info.append("Attributes:") + self.text_info.append("<b><font size=4>" + "File name: " + ncFileName + "</font></b>") + self.text_info.append("<b><font size=3>" + "Title: " + ncFileTitle + "</font></b>") + self.text_info.append("<b><font size=3>" + "Variable name: " + self.tree_data.currentItem().text(0) + "</font></b>") + self.text_info.append("<b><font size=3>" + "Long name: " + self.tree_data.currentItem().text(1) + "</font></b>") + self.text_info.append(" ") + self.text_info.append("<b><font size=3>" + "Attributes:" + "</font></b>") variableAttributes = list(ncFile.groups[self.tree_data.currentItem().parent().text(0)].variables[self.tree_data.currentItem().text(0)].ncattrs()) for i in range(len(variableAttributes)): - self.text_info.append("-- " + variableAttributes[i] + ": " + str(ncFile.groups[self.tree_data.currentItem().parent().text(0)].variables[self.tree_data.currentItem().text(0)].getncattr(variableAttributes[i]))) + self.text_info.append("<b>" + "-- " + variableAttributes[i] + ": " + "</b>" + str(ncFile.groups[self.tree_data.currentItem().parent().text(0)].variables[self.tree_data.currentItem().text(0)].getncattr(variableAttributes[i]))) #we close the netCDF file ncFile.close() @@ -349,7 +352,12 @@ class maskAndFuntionality (BASE, WIDGET): #load the raster layer into the QGIS canvas rasterLayer = QgsRasterLayer(uri, nameOfRasterLayer, "gdal") - print(rasterLayer.isValid()) + + if not rasterLayer.isValid(): + self.iface.messageBar().pushMessage("Error", "The layer is not valid", level=Qgis.Critical, duration=5) + return + + #calculate the band number diff --git a/metadata.txt b/metadata.txt index 7cfd4d64b869152ddd984bc6354e5af508e903d2..2dc81e0c17a10c162eb2605d61c9b7f1f09b203a 100644 --- a/metadata.txt +++ b/metadata.txt @@ -1,3 +1,12 @@ +# This file contains metadata for your plugin. Since +# version 2.0 of QGIS this is the proper way to supply +# information about a plugin. The old method of +# embedding metadata in __init__.py will +# is no longer supported since version 2.0. + + +# This file should be included when you package your plugin.# Mandatory items: + [general] name=EBVCubeVisualizer email=e.oceguera@gmx.de @@ -6,4 +15,21 @@ qgisMinimumVersion=3.0 description=The user can visualizes netCDF formatted data. about=The Plugin visualizes netCDF formatted data in a more efficient way, as well as creates plots of the data and can be exported. version=0.1 -tags=python,netCDF,Visualizer \ No newline at end of file + + +repository=https://github.com/EmmaOceg/EBVCubeVisualizerPlugin + +#end of the mandatory metadata + +#tags are comma separated with spaces allowed +tags=python,netCDF,Visualizer, EBVCube, EuropaBon + +homepage=http://homepage +category=Plugins +icon=EBVIcon.png + +#experimental flag +experimental=False + +# deprecated flag (applies to the whole plugin, not just a single version) +deprecated=False