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
166 stars 36 forks source link

Using Mesh layer to display output #47

Closed saberraz closed 6 years ago

saberraz commented 6 years ago

Currently the outputs are loaded back in QGIS as a raster. Ideally you should use mesh layer API to load the grib directly in QGIS 3.2+: https://twitter.com/lutraconsulting/status/1018809991103500288

If your output contains vector, it will be displayed as a part of your mesh layer. You can also explore the time dimension.

image

letmaik commented 6 years ago

Do you have any more documentation or tutorial/example on how to do that exactly?

saberraz commented 6 years ago

It is a very recent feature (for background reading: https://github.com/qgis/QGIS-Enhancement-Proposals/issues/119).

The idea is to use mesh layer (if supported by mdal, which grib is supported) in addition to gda/ogr. Here is the API: https://qgis.org/api/classQgsMeshLayer.html

For example for a grib file you just do QgsMeshLayer (“path/to/file.grb”, “my layer”, “mdal”)

If you are using a custom mesh, you can add it to mdal here: https://github.com/lutraconsulting/MDAL A copy of the code at the moment is shipped with QGIS: https://github.com/qgis/QGIS/tree/master/external/mdal

Let us know if you need help.

Cheers Saber

letmaik commented 6 years ago

The output files of WRF are a custom NetCDF variant which I think you're aware of as you also (partly?) support this in your Crayfish plugin. We're not that much interested at the moment in visualizing the GRIB input files, but more the simulation outputs. If that means extending MDAL then I don't think we currently have the resources to do that. I guess in principle it would be good if mdal would support some kind of funky path syntax to explicitly open a vector quantity made out of two netcdf variables, e.g. "NETCDF:'path/to/file.nc':WIND_U,WIND_V", otherwise I wouldn't know how it could auto-detect vector quantities as there is not enough metadata in general in NetCDF at the moment, and definitely not in WRF output files. You could of course use some heuristics and guess that two variables with same prefix and suffixes of _U/_V etc. and compatible shape may be vector quantities, but it would be good to have more explicit control over it as well.

saberraz commented 6 years ago

At the moment, mdal does not support netcdf. For the vectors, it autodetects the vectors. As long as you can read the nc file with cdo, ncdump or gdalinfo, it will be easy to guess various quantities.

You can still load your nc data as gdal layer obviously. But we are planning to add 3D support for mesh layer in future which will not display your nc file with the correct z scale if it is loaded as raster.....

letmaik commented 6 years ago

I'm closing this for now since there is nothing for us to do here at the moment. Feel free to ping us again once MDAL supports NetCDF.