Skip to content

[Bug]: Weights of evidence calculate weights - process freezes #501

@ambaaer

Description

@ambaaer

Describe the bug
"Weights of evidence calculate weights" freezes at 75%. The issue might be that the input for Deposits is not in the correct format, but it's unclear what the correct format should be (is it supposed to work with positives (1) and negatives (0)?). There is no error message informing the user. Additionally, when using a shape file for Deposits the user can't select a column.

How to reproduce the bug
Run "Weights of evidence calculate weights" with a proxy as evidential raster (e.g. distance to structures) and for Deposits select a raster with values 0 (no deposit), 1 (deposit) and NoData for background. Alternatively, use a shape file with multiple columns with one column containing the labels 0 and 1. Leave the other parameters at their default.

Expected behavior
Process freezes at 75% and the following log is displayed:
QGIS version: 3.34.12-Prizren
QGIS code revision: eeb6af3638
Qt version: 5.15.13
Python version: 3.12.7
GDAL version: 3.9.3
GEOS version: 3.13.0-CAPI-1.19.0
PROJ version: Rel. 9.5.0, September 15th, 2024
PDAL version: 2.8.1 (git-version: a06325)
Algorithm started at: 2025-03-28T11:34:40
Algorithm 'Weights of evidence calculate weights' starting…
Input parameters:
{ 'arrays_to_generate' : [], 'deposits' : 'C:/Users/baer/Praktikum_Beak/EIS/EIS_Workshop_QGIS_Project/Training_data/Training_data_rasterized_fill42_replace42nodata.tif', 'evidential_raster' : 'C:/Users/baer/Praktikum_Beak/EIS/EIS_Workshop_QGIS_Project/Proxies/Distance_to_structures.tif', 'output_raster_dir' : 'TEMPORARY_OUTPUT', 'output_results_table' : 'TEMPORARY_OUTPUT', 'raster_nodata' : None, 'studentized_contrast_threshold' : 1, 'weights_type' : 0 }

C:\Users\baer\Praktikum_Beak\python_environments\EIS_env_py3913\lib\site-packages\geopandas_compat.py:112: UserWarning: The Shapely GEOS version (3.10.3-CAPI-1.16.1) is incompatible with the GEOS version PyGEOS was compiled with (3.10.4-CAPI-1.16.2). Conversions between both will be slow.
warnings.warn(
Progress: 10%
Progress: 25%
C:\Users\baer\Praktikum_Beak\python_environments\EIS_env_py3913\lib\site-packages\eis_toolkit\prediction\weights_of_evidence.py:127: RuntimeWarning: divide by zero encountered in scalar divide
s_w_plus = np.sqrt((1 / p_A_nominator) + (1 / p_C_nominator))
Progress: 75%
+--------------------- Traceback (most recent call last) ---------------------+
| C:\Users\baer\Praktikum_Beak\python_environments\EIS_env_py3913\lib\site-pa |
| ckages\eis_toolkit\cli.py:3170 in weights_of_evidence_calculate_weights_cli |
| |
| 3167 array = nan_to_nodata(array, raster_meta["nodata"]) |
| 3168 output_raster_name = file_name + "weights" + weights_type |
| 3169 output_raster_path = output_raster_dir.joinpath(output_raste |
| > 3170 with rasterio.open(output_raster_path, "w", dtype=dtype, **r |
| 3171 dst.write(array, 1) |
| 3172 out_rasters_dict[output_raster_name] = str(output_raster_pat |
| 3173 |
| |
| +-------------------------------- locals ---------------------------------+ |
| | array = array([[23480.28320312, | |
| | 22519.45507812, 21562.18945312, ..., | |
| | 2317.52880859, | |
| | 2344.81884766, 2364.11816406], | |
| | [23228.8203125 , | |
| | 22257.13867188, 21288.08007812, ..., | |
| | 1348.22241211, | |
| | 1394.36303711, 1378.875 ], | |
| | [23018.08984375, | |
| | 22037.11914062, 21057.93945312, ..., | |
| | 460.89746094, | |
| | 617.23583984, 462.10092163], | |
| | ..., | |
| | [10952.99902344, | |
| | 9953.27929688, 8953.62109375, ..., | |
| | 3932.91162109, | |
| | 4375.66748047, 4982.48339844], | |
| | [11020.99316406, 10028.0546875 | |
| | , 9036.67285156, ..., | |
| | 4885.02392578, | |
| | 5248.06005859, 5763.74951172], | |
| | [11178.390625 , | |
| | 10200.78320312, 9227.9765625 , ..., | |
| | 5853.12939453, | |
| | 6159.36669922, 6604.27685547]]) | |
| | arrays = { | |
| | 'Class': array([[23480.28320312, | |
| | 22519.45507812, 21562.18945312, ..., | |
| | 2317.52880859, | |
| | 2344.81884766, 2364.11816406], | |
| | [23228.8203125 , | |
| | 22257.13867188, 21288.08007812, ..., | |
| | 1348.22241211, | |
| | 1394.36303711, 1378.875 ], | |
| | [23018.08984375, | |
| | 22037.11914062, 21057.93945312, ..., | |
| | 460.89746094, | |
| | 617.23583984, 462.10092163], | |
| | ..., | |
| | [10952.99902344, | |
| | 9953.27929688, 8953.62109375, ..., | |
| | 3932.91162109, | |
| | 4375.66748047, 4982.48339844], | |
| | [11020.99316406, 10028.0546875 | |
| | , 9036.67285156, ..., | |
| | 4885.02392578, | |
| | 5248.06005859, 5763.74951172], | |
| | [11178.390625 , | |
| | 10200.78320312, 9227.9765625 , ..., | |
| | 5853.12939453, | |
| | 6159.36669922, 6604.27685547]]), | |
| | 'W+': array([[0., 0., 0., ..., 0., | |
| | 0., 0.], | |
| | [0., 0., 0., ..., 0., 0., 0.], | |
| | [0., 0., 0., ..., 0., 0., 0.], | |
| | ..., | |
| | [0., 0., 0., ..., 0., 0., 0.], | |
| | [0., 0., 0., ..., 0., 0., 0.], | |
| | [0., 0., 0., ..., 0., 0., | |
| | 0.]]), | |
| | 'S_W+': array([[0., 0., 0., ..., | |
| | 0., 0., 0.], | |
| | [0., 0., 0., ..., 0., 0., 0.], | |
| | [0., 0., 0., ..., 0., 0., 0.], | |
| | ..., | |
| | [0., 0., 0., ..., 0., 0., 0.], | |
| | [0., 0., 0., ..., 0., 0., 0.], | |
| | [0., 0., 0., ..., 0., 0., 0.]]) | |
| | } | |
| | arrays_to_generate = None | |
| | deposits = <open DatasetReader | |

Environment details

  • OS: Windows
  • Python version: 3.9.13
  • QGIS version: 3.34.12
  • EIS Toolkit version: 1.1.3
  • EIS QGIS Plugin version: 1.0.3
  • GDAL version: 3.8.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions