Hi, I have a similar problem with processing my soil group raster dataset. When I run the model, the error that I get is that "a value in my raster is outside the range of (1,2,3,4). I have read the responses in this thread over and over. I have used the reclassify raster function and the raster calculator to classify all values >4 as null, in two separate instances. The solution that is proposed above, of reclassifying NODATA to 7 does not seem to work for my data. Currently, my raster has these values (1,2,3,4,NODATA) showing up. What could I be doing wrong please?
Here is my log and my soil group dataset.
2022-02-27 21:11:16,930 (natcap.invest.utils) utils.prepare_workspace(162) Level 100 Writing log messages to C:\Users\slebu\Documents\urban_flood_risk_mitigation_workspace\InVEST-Urban-Flood-Risk-Mitigation-log-2022-02-27–21_11_16.txt
2022-02-27 21:11:16,932 (natcap.invest.ui.model) model._logged_target(1643) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.urban_flood_risk_mitigation 3.10.1:
aoi_watersheds_path C:/Users/slebu/OneDrive/Documents/INVEST/watershed/projected dare watershed/dare_projected_watershed.shp
built_infrastructure_vector_path C:/Users/slebu/OneDrive/Documents/INVEST/buildfootprint/Shape/buildings_dare.shp
curve_number_table_path C:/Users/slebu/OneDrive/Documents/INVEST/biophysical_table_3.csv
infrastructure_damage_loss_table_path C:/Users/slebu/OneDrive/Documents/INVEST/buildfootprint/Shape/buildfootprint2.csv
lulc_path C:/Users/slebu/OneDrive/Documents/ArcGIS/Projects/MyProject9/landcover_Clip.tif
n_workers -1
rainfall_depth 152.4
results_suffix dryrun11
soils_hydrological_group_raster_path C:/Users/slebu/OneDrive/Documents/ArcGIS/Projects/MyProject16/setnull_soil.tif
workspace_dir C:\Users\slebu\Documents\urban_flood_risk_mitigation_workspace
2022-02-27 21:11:16,934 (natcap.invest.validation) validation._wrapped_validate_func(1026) DEBUG Using ARG_SPEC for validation
2022-02-27 21:11:16,934 (natcap.invest.validation) validation._wrapped_validate_func(1030) INFO Starting whole-model validation with ARGS_SPEC
2022-02-27 21:11:16,934 (natcap.invest.validation) validation.timeout(716) DEBUG Starting file checking thread with timeout=5
2022-02-27 21:11:16,993 (natcap.invest.validation) validation.timeout(727) DEBUG File checking thread completed.
2022-02-27 21:11:16,993 (natcap.invest.validation) validation.timeout(716) DEBUG Starting file checking thread with timeout=5
2022-02-27 21:11:17,035 (natcap.invest.validation) validation.timeout(727) DEBUG File checking thread completed.
2022-02-27 21:11:17,035 (natcap.invest.validation) validation.timeout(716) DEBUG Starting file checking thread with timeout=5
2022-02-27 21:11:17,040 (natcap.invest.validation) validation.timeout(727) DEBUG File checking thread completed.
2022-02-27 21:11:17,040 (natcap.invest.validation) validation.timeout(716) DEBUG Starting file checking thread with timeout=5
2022-02-27 21:11:17,041 (natcap.invest.validation) validation.timeout(727) DEBUG File checking thread completed.
2022-02-27 21:11:17,041 (natcap.invest.validation) validation.timeout(716) DEBUG Starting file checking thread with timeout=5
2022-02-27 21:11:17,063 (natcap.invest.validation) validation.timeout(727) DEBUG File checking thread completed.
2022-02-27 21:11:17,063 (natcap.invest.validation) validation.timeout(716) DEBUG Starting file checking thread with timeout=5
2022-02-27 21:11:17,559 (natcap.invest.validation) validation.timeout(727) DEBUG File checking thread completed.
2022-02-27 21:11:17,559 (natcap.invest.validation) validation.timeout(716) DEBUG Starting file checking thread with timeout=5
2022-02-27 21:11:17,586 (natcap.invest.validation) validation.timeout(727) DEBUG File checking thread completed.
2022-02-27 21:11:17,654 (natcap.invest.validation) validation._wrapped_validate_func(1067) DEBUG Validation warnings: []
2022-02-27 21:11:17,691 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(396) INFO starting stats_worker
2022-02-27 21:11:17,692 (pygeoprocessing.geoprocessing_core) threading.run(870) DEBUG stats worker PID: 11040
2022-02-27 21:11:17,692 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(402) INFO started stats_worker <Thread(Thread-349, started daemon 29452)>
2022-02-27 21:11:17,698 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(498) ERROR exception encountered in raster_calculator
Traceback (most recent call last):
File “natcap\invest\urban_flood_risk_mitigation.py”, line 815, in _lu_to_cn_op
File “<array_function internals>”, line 5, in choose
File “numpy\core\fromnumeric.py”, line 429, 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 443, in raster_calculator
File “natcap\invest\urban_flood_risk_mitigation.py”, line 822, 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)
2022-02-27 21:11:17,700 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(513) INFO Waiting for raster stats worker result.
2022-02-27 21:11:17,700 (pygeoprocessing.geoprocessing_core) threading.run(870) WARNING No valid pixels were received, sending None.
2022-02-27 21:11:17,700 (taskgraph.Task) Task.add_task(706) 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 815, in _lu_to_cn_op
File “<array_function internals>”, line 5, in choose
File “numpy\core\fromnumeric.py”, line 429, 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 674, in add_task
File “taskgraph\Task.py”, line 1093, in _call
File “pygeoprocessing\geoprocessing.py”, line 443, in raster_calculator
File “natcap\invest\urban_flood_risk_mitigation.py”, line 822, 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)
2022-02-27 21:11:17,704 (natcap.invest.utils) utils.prepare_workspace(167) ERROR Exception while executing Urban-Flood-Risk-Mitigation
Traceback (most recent call last):
File “natcap\invest\urban_flood_risk_mitigation.py”, line 815, in _lu_to_cn_op
File “<array_function internals>”, line 5, in choose
File “numpy\core\fromnumeric.py”, line 429, 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 165, in prepare_workspace
File “natcap\invest\ui\model.py”, line 1649, in _logged_target
File “natcap\invest\urban_flood_risk_mitigation.py”, line 233, in execute
File “taskgraph\Task.py”, line 674, in add_task
File “taskgraph\Task.py”, line 1093, in _call
File “pygeoprocessing\geoprocessing.py”, line 443, in raster_calculator
File “natcap\invest\urban_flood_risk_mitigation.py”, line 822, 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)
2022-02-27 21:11:17,708 (natcap.invest.utils) utils.prepare_workspace(170) INFO Elapsed time: 0.78s
2022-02-27 21:11:17,709 (natcap.invest.utils) utils.prepare_workspace(173) INFO Execution finished
setnull_soil.tif (901.1 KB)