Urban Stormwater Retention Model IndexError

Hello! Trying to start Urban Stormwater Retention Model but got error:
IndexError: arrays used as indices must be of integer (or boolean) type

Here the Data.
Data.zip (16.3 KB)

biophysical_table.csv (338 Bytes)

THX ALL

workspace_dir D:\Invest\Uswr

log file data
2022-09-15 13:30:43,123 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(396) INFO starting stats_worker
2022-09-15 13:30:43,126 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(402) INFO started stats_worker <Thread(Thread-1 (stats_worker), started daemon 34364)>
2022-09-15 13:30:43,132 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(498) ERROR exception encountered in raster_calculator
Traceback (most recent call last):
File “pygeoprocessing\geoprocessing.py”, line 443, in raster_calculator
File “natcap\invest\stormwater.py”, line 671, in ratio_op
IndexError: arrays used as indices must be of integer (or boolean) type
2022-09-15 13:30:43,133 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(513) INFO Waiting for raster stats worker result.
2022-09-15 13:30:43,134 (pygeoprocessing.geoprocessing_core) threading.run(946) WARNING No valid pixels were received, sending None.
2022-09-15 13:30:43,134 (taskgraph.Task) Task.add_task(706) ERROR Something went wrong when adding task calculate stormwater retention ratio (1), terminating taskgraph.
Traceback (most recent call last):
File “taskgraph\Task.py”, line 674, in add_task
File “taskgraph\Task.py”, line 1093, in _call
File “natcap\invest\stormwater.py”, line 674, in lookup_ratios
File “pygeoprocessing\geoprocessing.py”, line 443, in raster_calculator
File “natcap\invest\stormwater.py”, line 671, in ratio_op
IndexError: arrays used as indices must be of integer (or boolean) type
2022-09-15 13:30:43,135 (natcap.invest.utils) utils.prepare_workspace(167) ERROR Exception while executing natcap.invest.stormwater
Traceback (most recent call last):
File “natcap\invest\utils.py”, line 165, in prepare_workspace
File “natcap\invest\cli.py”, line 486, in main
File “natcap\invest\stormwater.py”, line 284, in execute
File “taskgraph\Task.py”, line 674, in add_task
File “taskgraph\Task.py”, line 1093, in _call
File “natcap\invest\stormwater.py”, line 674, in lookup_ratios
File “pygeoprocessing\geoprocessing.py”, line 443, in raster_calculator
File “natcap\invest\stormwater.py”, line 671, in ratio_op
IndexError: arrays used as indices must be of integer (or boolean) type
2022-09-15 13:30:43,136 (natcap.invest.utils) utils.prepare_workspace(170) INFO Elapsed time: 0.09s
2022-09-15 13:30:43,136 (natcap.invest.utils) utils.prepare_workspace(173) INFO Execution finished

Hi @BatTerZ,

Thanks for posting, would you mind also attaching the logfile? The copied snippet is helpful but the entire logfile will give us the complete picture. Thanks!

Doug

Sure

InVEST-natcap.invest.stormwater-log-2022-09-15–13_30_43.txt (3.5 KB)

1 Like

Hi @BatTerZ,

Sorry for the delay on this. It looks like the issue is due to the soil input raster SOIL_1.tif having a float type and instead of an int type. In a lot of cases throughout InVEST we’re able to handle this just fine without imposing hard requirements on the user before running the models. However, in this case we aren’t handling it correctly and it’s a bug.

I’ve uploaded an integer version of your soil raster, could you try using that and see if you can get the model running? Thanks!

SOIL_1_INT.tif (420.2 KB)

~ Doug

1 Like

Thx for help! i forgot to convert float to integer when converting soil from vector to raster. it works with you layer.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.