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

WPS Binary export lat/lon #192

Closed Plantain closed 3 years ago

Plantain commented 3 years ago

Describe the bug I'm not able to make the WPS Binary export work with the information provided in the tutorials - it seems like the binary export expects files to be in lon/lat format, but QGIS expects files to be in lat/lon format. It's not obvious to me how it's actually then meant to work?

To Reproduce Download http://www.bom.gov.au/jsp/awra/thredds/fileServer/AWRACMS/values/day/s0_pct_2020.nc Open with QGIS Dataset -> Process -> Convert active layer to WPS binary Receive error: "Unsupported data axis order: Lat/Lon, must be Lon/Lat. Interested in making GIS4WRF better? Consider contributing code or adding a feature request."

Flip the axis: ncpdq --rdr time,longitude,latitude s0_pct_2020_Actual_day.nc rdr.nc ncdump -h rdr.nc; Observe the axis have been reordered Open with QGIS Note that the geographic position of the data on the map is now above the north pole. Proceeding anyway, Dataset -> Process -> Convert active layer to WPS binary AssertionError Traceback (most recent call last): File "/home/plantain/.local/share/QGIS/QGIS3/profiles/default/python/plugins/gis4wrf/plugin/ui/widget_process.py", line 46, in run_convert_to_wps_binary output = convert_to_wps_binary(source, out_dir, is_categorical, strict_datum=False) File "/home/plantain/.local/share/QGIS/QGIS3/profiles/default/python/plugins/gis4wrf/core/writers/wps_binary.py", line 152, in convert_to_wps_binary index_dict, datum_mismatch, inv_scale_factor, dst_dtype, dst_no_data_value = create_index_dict( File "/home/plantain/.local/share/QGIS/QGIS3/profiles/default/python/plugins/gis4wrf/core/writers/wps_binary.py", line 320, in create_index_dict assert dx > 0 AssertionError

Expected behavior GIS4WRF should either handle lat/lon and lon/lat files, or document how the data should be prepared for usage.

*System Information (please complete the following information):** Linux QGIS 3.14.16

dmey commented 3 years ago

This seems a duplicate of https://github.com/GIS4WRF/gis4wrf/issues/165 and https://github.com/GIS4WRF/gis4wrf/issues/191 in which case was fixed in https://github.com/GIS4WRF/gis4wrf/pull/185. Can you confirm that you have GIS4WRF 0.14.4 installed? This was not present in your report.

Plantain commented 3 years ago

Installed today: 0.14.4

On Tue, Sep 29, 2020 at 11:50 AM dmey notifications@github.com wrote:

This seems a duplicate of #165 https://github.com/GIS4WRF/gis4wrf/issues/165 and #191 https://github.com/GIS4WRF/gis4wrf/issues/191 in which case was fixed in #185 https://github.com/GIS4WRF/gis4wrf/pull/185. Can you conform that you have GIS4WRF 0.14.4 installed? This was not present in your report.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GIS4WRF/gis4wrf/issues/192#issuecomment-700595273, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACODFY7KMYS3XPYSTLXUZDSIGUU7ANCNFSM4R5RBEHQ .

dmey commented 3 years ago

I think that the reason for this is that the CRS is not read in properly when you load the netCDF file (I think we always tested GeoTIFF as the only use case...). I was able to convert to WPS binary but you need to convert to GeoTIFF first and assign the correct CRS. So, QGIS > Layer > Add Layer > Add Raster Layer > s0_pct_2020.nc. Then from the Layers widow, select s0_pct_2020, right click > export, Save Raster Layer as... Assign ESPG 4326 (assumption given that it missing from your metadata!) or wherever else you deem correct, then save (and load the GeoTIFF in QGIS). You should now be able to select the layer and create the dataset from GIS4WRF > Dataset -> Process -> Convert active layer to WPS binary. Let me know how you get on. If you can spare some time and fancy improving the docs that would be much appreciated 😉.

dmey commented 3 years ago

@Plantain did you solve the issue?

dmey commented 3 years ago

Closing as no response from user.