gem/oq-irmt-qgis

qgsEditError on macOS Catalina with qgis3.16.2, oq3.7.1, irmt3.7.2

Closed this issue · 3 comments

An error has occurred while executing Python code: 
qgis.core.additions.edit.QgsEditError: ['ERROR: 1642 feature(s) not added.', '\n  Provider errors:', '    Could not store attribute "economic_income": Could not convert value "Low" to target type'] 
Traceback (most recent call last):
  File "/Users/cyepes/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/svir/dialogs/load_output_as_layer_dialog.py", line 849, in accept
    self.load_from_npz()
  File "/Users/cyepes/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/svir/dialogs/load_dmg_by_asset_as_layer_dialog.py", line 302, in load_from_npz
    dmg_state=dmg_state)
  File "/Users/cyepes/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/svir/dialogs/load_output_as_layer_dialog.py", line 474, in build_layer
    loss_type=loss_type, dmg_state=dmg_state, imt=imt)
  File "/Users/cyepes/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/svir/dialogs/load_dmg_by_asset_as_layer_dialog.py", line 190, in read_npz_into_layer
    self.read_npz_into_layer_no_aggr(field_names, **kwargs)
  File "/Users/cyepes/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/svir/dialogs/load_dmg_by_asset_as_layer_dialog.py", line 220, in read_npz_into_layer_no_aggr
    log_msg(msg, level='C', message_bar=self.iface.messageBar())
  File "/Applications/QGIS3.16.app/Contents/MacOS/../Resources/python/qgis/core/additions/edit.py", line 44, in __exit__
    raise QgsEditError(self.layer.commitErrors())
qgis.core.additions.edit.QgsEditError: ['ERROR: 1642 feature(s) not added.', '\n  Provider errors:', '    Could not store attribute "economic_income": Could not convert value "Low" to target type']
Python version: 3.7.7 (default, Sep 22 2020, 10:25:18) [Clang 12.0.0 (clang-1200.0.32.2)] 
QGIS version: 3.16.2-Hannover Hannover, c6ac5a6052 
Python Path:
/Applications/QGIS3.16.app/Contents/MacOS/../Resources/python
/Users/cyepes/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/cyepes/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS3.16.app/Contents/MacOS/../Resources/python/plugins
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/matplotlib-3.3.0-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/pandas-1.1.0-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/geopandas-0.8.1-py3.7.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/click_plugins-1.1.1-py3.7.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/rasterio-1.1.5-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/snuggs-1.4.7-py3.7.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python37.zip
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/scipy-1.5.1-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/numpy-1.19.1-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/netCDF4-1.5.3-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/patsy-0.5.1-py3.7.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/Rtree-0.9.4-py3.7.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/pyproj-2.6.0-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/GDAL-3.1.2-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/lib-dynload
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/numba-0.50.1-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/opencv_contrib_python-4.3.0.36-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/statsmodels-0.11.1-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/affine-2.3.0-py3.7.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/Fiona-1.8.13.post1-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7
/Applications/QGIS3.16.app/Contents/MacOS/lib/python3.7/site-packages/cftime-1.2.1-py3.7-macosx-10.13.0-x86_64.egg
/Users/cyepes/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/cyepes/Downloads/OpenQuake/M2_Part1_Exercise/Material

This happens after running the following calculation and trying to load Average Asset Damages:
2_Scenario_Risk_Antioquia.zip

On Ubuntu20.04.2LTS the error does not occur by just selecting that output and proceeding without changing any options in the following dialog. I am using the same versions of OQ and IRMT, but QGIS3.16.4 instead of QGIS3.16.2.

I was able to reproduce the issue by selecting the Average Asset Damages output and then unchecking the option Aggregate by site

The issue was fixed and an unofficial version 3.7.3 was prepared.