GIS4WRF / gis4wrf

QGIS toolkit 🧰 for pre- and post-processing πŸ”¨, visualizing πŸ”, and running simulations πŸ’» in the Weather Research and Forecasting (WRF) model πŸŒ€
https://gis4wrf.github.io
MIT License
159 stars 36 forks source link

Error loading plugin if some GRIB files of downloaded met data have different variables #151

Closed letmaik closed 4 years ago

letmaik commented 4 years ago

From https://github.com/GIS4WRF/gis4wrf/issues/149#issuecomment-561540690:

Next is the error message when GIS4WRF plugin is activated

File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\plugin\plugin.py", line 85, in show_dock
self.dock_widget = MainDock(self.iface, self.dock_widget)
File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\plugin\ui\dock.py", line 22, in init
self.simulation_tab = SimulationTab(iface)
File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\plugin\ui\tab_simulation.py", line 53, in init
self.set_project_in_tabs()
File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\plugin\ui\tab_simulation.py", line 74, in set_project_in_tabs
self.datasets_tab.project = project
File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\plugin\ui\widget_datasets.py", line 71, in project
self.populate_met_data_tree()
File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\plugin\ui\widget_datasets.py", line 660, in populate_met_data_tree
folder_meta, file_metas = read_grib_folder_metadata(time_range_folder)
File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\core\readers\grib_metadata.py", line 32, in read_grib_folder_metadata
return read_grib_files_metadata(paths)
File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\core\readers\grib_metadata.py", line 49, in read_grib_files_metadata
assert meta.variables == variables
AssertionError

The assumption so far was that all GRIB files downloaded for some time period would have the same variables. Checking this is more for sanity, but not strictly required. The only place where the variables are displayed is when right-clicking on a time range and selecting "Show variables". I think this check can be relaxed (removed) and instead the the union of all variables are taken for the purpose of displaying them, without requiring that all variables are present in all files. If there is an issue later on, then WPS will fail anyway.