Value Map Error in Urban Cooling Model

We are receiving the following errors in our report when we run the Urban Cooling Model:

2020-10-30 16:16:21,158 utils.prepare_workspace(111) INFO Writing log messages to C:/Users/Nicole/Desktop/DEVELOP/Sac_InVEST_Outputs\InVEST-Urban-Cooling-Model-log-2020-10-30–16_16_21.txt
2020-10-30 16:16:21,170 model._logged_target(1626) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.urban_cooling_model 3.8.9:
aoi_vector_path C:/Users/Nicole/Desktop/InVEST Inputs/AoI_UTM.shp
biophysical_table_path C:/Users/Nicole/Desktop/InVEST Inputs/Biophysical_Table.csv
cc_method factors
cc_weight_albedo 0.2
cc_weight_eti 0.2
cc_weight_shade 0.6
do_valuation False
green_area_cooling_distance 400
lulc_raster_path C:/Users/Nicole/Desktop/InVEST Inputs/LULC_raster_UTM.tif
n_workers -1
ref_eto_raster_path C:/Users/Nicole/Desktop/InVEST Inputs/ET_mean_UTM_Copy.tif
results_suffix _sac
t_air_average_radius 2000
t_ref 34.58
uhi_max 7.10
workspace_dir C:/Users/Nicole/Desktop/DEVELOP/Sac_InVEST_Outputs

2020-10-30 16:16:21,326 urban_cooling_model.execute(296) INFO Starting Urban Cooling Model
2020-10-30 16:16:21,812 utils._log_gdal_errors(68) ERROR [errno 1] Deleting C:/Users/Nicole/Desktop/DEVELOP/Sac_InVEST_Outputs\intermediate\lulc_sac.tif failed: Permission denied
2020-10-30 16:16:21,813 utils._log_gdal_errors(68) ERROR [errno 1] Deleting C:/Users/Nicole/Desktop/DEVELOP/Sac_InVEST_Outputs\intermediate\lulc_sac.tif.ovr failed: Permission denied
2020-10-30 16:16:26,333 geoprocessing.align_and_resize_raster_stack(752) INFO 1 of 2 aligned: lulc_sac.tif
2020-10-30 16:16:31,979 geoprocessing.logger_callback(3239) INFO Warp 38.0% complete C:/Users/Nicole/Desktop/DEVELOP/Sac_InVEST_Outputs\intermediate\ref_eto_sac.tif
2020-10-30 16:16:37,028 geoprocessing.logger_callback(3239) INFO Warp 92.0% complete C:/Users/Nicole/Desktop/DEVELOP/Sac_InVEST_Outputs\intermediate\ref_eto_sac.tif
2020-10-30 16:16:37,446 geoprocessing.logger_callback(3239) INFO Warp 100.0% complete C:/Users/Nicole/Desktop/DEVELOP/Sac_InVEST_Outputs\intermediate\ref_eto_sac.tif
2020-10-30 16:16:38,681 geoprocessing.align_and_resize_raster_stack(752) INFO 2 of 2 aligned: ref_eto_sac.tif
2020-10-30 16:16:38,682 geoprocessing.align_and_resize_raster_stack(754) INFO aligned all 2 rasters.
2020-10-30 16:16:38,792 geoprocessing.raster_calculator(375) INFO starting stats_worker
2020-10-30 16:16:38,800 geoprocessing.raster_calculator(381) INFO started stats_worker <Thread(Thread-1185, started daemon 1528)>
2020-10-30 16:16:38,838 threading.run(870) DEBUG payload is None, terminating
2020-10-30 16:16:38,838 geoprocessing.raster_calculator(486) INFO Waiting for raster stats worker result.
2020-10-30 16:16:38,840 Task.add_task(731) ERROR Something went wrong when adding task reclassify to kc (1), terminating taskgraph.
Traceback (most recent call last):
File “site-packages\taskgraph\Task.py”, line 697, in add_task
File “site-packages\taskgraph\Task.py”, line 1174, in _call
File “site-packages\pygeoprocessing\geoprocessing.py”, line 1763, in reclassify_raster
File “site-packages\pygeoprocessing\geoprocessing.py”, line 424, in raster_calculator
File “site-packages\pygeoprocessing\geoprocessing.py”, line 1756, in _map_dataset_to_value_op
ValueError: The following 1 raster values [127] from “C:/Users/Nicole/Desktop/DEVELOP/Sac_InVEST_Outputs\intermediate\lulc_sac.tif” do not have corresponding entries in the value_map: {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1, 13: 1, 14: 1, 15: 1, 16: 1, 17: 1, 18: 1, 19: 1, 20: 1}
2020-10-30 16:16:38,842 model._logged_target(1632) ERROR Exception while executing <function execute at 0x1ED01618>
Traceback (most recent call last):
File “site-packages\natcap\invest\ui\model.py”, line 1629, in _logged_target
File “site-packages\natcap\invest\urban_cooling_model.py”, line 398, in execute
File “site-packages\taskgraph\Task.py”, line 697, in add_task
File “site-packages\taskgraph\Task.py”, line 1174, in _call
File “site-packages\pygeoprocessing\geoprocessing.py”, line 1763, in reclassify_raster
File “site-packages\pygeoprocessing\geoprocessing.py”, line 424, in raster_calculator
File “site-packages\pygeoprocessing\geoprocessing.py”, line 1756, in _map_dataset_to_value_op
ValueError: The following 1 raster values [127] from “C:/Users/Nicole/Desktop/DEVELOP/Sac_InVEST_Outputs\intermediate\lulc_sac.tif” do not have corresponding entries in the value_map: {0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1, 13: 1, 14: 1, 15: 1, 16: 1, 17: 1, 18: 1, 19: 1, 20: 1}
2020-10-30 16:16:38,843 model._logged_target(1635) INFO Execution finished
2020-10-30 16:16:38,850 utils.prepare_workspace(117) INFO Elapsed time: 17.69s

This value of 127 it says doesn’t have a corresponding value is strange. It doesn’t actually exist in our raster. It seems be being created by the model? The lulc raster intermediate output has a box around our study area filled with zeroes and then a bunch of pixels around the edge of our study area that suddenly have the 127 values.

Hi @nic.keller,

Thanks for including your log! We’ve very recently improved how InVEST handles signed byte rasters (and also the text of reclassification errors like this), so could you try the development build linked below and see if that resolves the issue for you?

https://storage.googleapis.com/releases.naturalcapitalproject.org/invest/3.8.9.post600+g93281903/InVEST_3.8.9.post600+g93281903_x64_Setup.exe

Thanks!
James

So we ended up solving the problem by setting the NoData value to the mystery 127 when we exported our raster to .tiff.
We also had to add a line in our attribute table with a Value of 0 and we called the category ‘Background’.

I don’t really know WHY these things solved the problem, but they did.

Well, I’m glad you were able to find a workaround!

Again, the handling of signed byte rasters should be dramatically improved in the forthcoming InVEST 3.9.0 release, for anyone coming across this thread in the future.

1 Like

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