UFRM: ValueError: invalid entry in choice array

While running the model error occuring, how to fix it? can someone please check and tell me what’s the problem?

2026-01-10 01:34:08,054 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(540) ERROR exception encountered in raster_calculator

Traceback (most recent call last):
File “natcap\invest\urban_flood_risk_mitigation.py”, line 922, in _lu_to_cn_op
File “numpy\_core\fromnumeric.py”, line 455, in choose
File “numpy\_core\fromnumeric.py”, line 57, in _wrapfunc
ValueError: invalid entry in choice array

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “pygeoprocessing\geoprocessing.py”, line 476, in raster_calculator
File “natcap\invest\urban_flood_risk_mitigation.py”, line 929, in _lu_to_cn_op
ValueError: invalid entry in choice array
Check that the Soil Group raster does not contain values other than (1, 2, 3, 4)
2026-01-10 01:34:08,058 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(555) INFO Waiting for raster stats worker result.
2026-01-10 01:34:08,058 (pygeoprocessing.geoprocessing_core) threading.run(994) WARNING No valid pixels were received, sending None.
2026-01-10 01:34:08,059 (taskgraph.Task) Task.add_task(716) ERROR Something went wrong when adding task create Curve Number raster (1), terminating taskgraph.
Traceback (most recent call last):
File “natcap\invest\urban_flood_risk_mitigation.py”, line 922, in _lu_to_cn_op
File “numpy\_core\fromnumeric.py”, line 455, in choose
File “numpy\_core\fromnumeric.py”, line 57, in _wrapfunc
ValueError: invalid entry in choice array

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “taskgraph\Task.py”, line 684, in add_task
File “taskgraph\Task.py”, line 1103, in _call
File “src/pygeoprocessing/geoprocessing_core.pyx”, line 77, in pygeoprocessing.geoprocessing_core.gdal_use_exceptions.wrapper
File “src/pygeoprocessing/geoprocessing_core.pyx”, line 78, in pygeoprocessing.geoprocessing_core.gdal_use_exceptions.wrapper
File “pygeoprocessing\geoprocessing.py”, line 476, in raster_calculator
File “natcap\invest\urban_flood_risk_mitigation.py”, line 929, in _lu_to_cn_op
ValueError: invalid entry in choice array
Check that the Soil Group raster does not contain values other than (1, 2, 3, 4)
2026-01-10 01:34:08,061 (natcap.invest.utils) utils.prepare_workspace(173) ERROR Exception while executing urban_flood_risk_mitigation
Traceback (most recent call last):
File “natcap\invest\urban_flood_risk_mitigation.py”, line 922, in _lu_to_cn_op
File “numpy\_core\fromnumeric.py”, line 455, in choose
File “numpy\_core\fromnumeric.py”, line 57, in _wrapfunc
ValueError: invalid entry in choice array

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “natcap\invest\utils.py”, line 171, in prepare_workspace
File “natcap\invest\spec.py”, line 1937, in execute
File “natcap\invest\urban_flood_risk_mitigation.py”, line 368, in execute
File “taskgraph\Task.py”, line 684, in add_task
File “taskgraph\Task.py”, line 1103, in _call
File “src/pygeoprocessing/geoprocessing_core.pyx”, line 77, in pygeoprocessing.geoprocessing_core.gdal_use_exceptions.wrapper
File “src/pygeoprocessing/geoprocessing_core.pyx”, line 78, in pygeoprocessing.geoprocessing_core.gdal_use_exceptions.wrapper
File “pygeoprocessing\geoprocessing.py”, line 476, in raster_calculator
File “natcap\invest\urban_flood_risk_mitigation.py”, line 929, in _lu_to_cn_op
ValueError: invalid entry in choice array
Check that the Soil Group raster does not contain values other than (1, 2, 3, 4)

Damage_loss_table.csv (199 Bytes)

Biophysical_water_SF.csv (199 Bytes)

soil2.tif (10.7 KB)

Hello @Rahi -

The error message says this:

ValueError: invalid entry in choice array
Check that the Soil Group raster does not contain values other than (1, 2, 3, 4)

Your soil group raster does contain values other than (1,2,3,4), it contains the value 13. The Data Needs section of the User Guide specifies values of only (1,2,3,4). The Data Sources Appendix provides information about how to handle this.

~ Stacie

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