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

Bug: AssertionError when writing to Geogrid Binary Format #135

Closed ianbtr closed 5 years ago

ianbtr commented 5 years ago

Description An AssertionError is displayed when attempting to convert the current layer to a WPS binary using the "Convert active layer to WPS binary" button/wizard.

To Reproduce

  1. Open any netcdf-3 file with non-categorical data as a layer. My file has the variables "lat_bnds", "lon_bnds" and a non-categorical quantity stored in it.
  2. With no other layers selected, click the "Convert active layer to WPS binary" button.
  3. Select "No" when prompted with "Is this layer's data categorical?"
  4. Select an empty directory from the file browser.

Expected behavior A geogrid binary format file should have been produced in the selected empty directory, along with an index file.

Screenshots image

Operating System Information (please complete the following information):

Additional context I will try with a single-variable and/or netcdf-4 file next. Really hoping that works.

letmaik commented 5 years ago

Thanks for the report. Would you be able to share a file which has that problem? If it's not too big you can attach it directly here.

ianbtr commented 5 years ago

It'll take me a few minutes to de-identify the data, but I'll have one for you momentarily.

Ian Bertram

On Sat, May 11, 2019 at 11:55 AM Maik Riechert notifications@github.com wrote:

Thanks for the report. Would you be able to share a file which has that problem? If it's not too big you can attach it directly here.

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

ianbtr commented 5 years ago

There we go.

Ian Bertram

On Sat, May 11, 2019 at 11:59 AM Ian Bertram ianbtr@umich.edu wrote:

It'll take me a few minutes to de-identify the data, but I'll have one for you momentarily.

Ian Bertram

On Sat, May 11, 2019 at 11:55 AM Maik Riechert notifications@github.com wrote:

Thanks for the report. Would you be able to share a file which has that problem? If it's not too big you can attach it directly here.

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

letmaik commented 5 years ago

@ianbtr I guess GitHub doesn't automatically attach email attachments. You probably have to use the web UI for that.

ianbtr commented 5 years ago

data.zip

Apparently the web interface doesn't like netcdf files.

letmaik commented 5 years ago

I could reproduce the issue and created a fix (#136). Please read the PR text for details. A quick way to work-around the issue without waiting for the next gis4wrf version is to simply re-save the layer from QGIS into a new GeoTIFF or NetCDF file (right-click on layer -> Export). This creates a file which doesn't lack CRS metadata and also doesn't trigger the assertion you reported.

Note that your layer data type is float and gis4wrf automatically encodes this into scale/offset integer format as this is what WPS Binary requires. In your particular case it chooses 64-bit floats (by estimating significant digits in the input data). This is all fine, but be aware that 64-bit WPS Binary datasets currently cannot be opened again in gis4wrf for visualization due to limitations in the underlying libraries (GDAL only supports up to 32-bit).

ianbtr commented 5 years ago

Thank you 👍 your help is very much appreciated.