KeyError encountered: '11.0' when running water yield model

Hello everyone.
When trying to run the Hydropower Water Yield Model, I have encountered an error with the message:
KeyError encountered: ‘11.0’

2021-06-29 12:35:23,430 hydropower_water_yield.execute(101) INFO Validating arguments
2021-06-29 12:35:23,436 validation._wrapped_validate_func(148) DEBUG Validation warnings: []
2021-06-29 12:35:23,457 geoprocessing.align_and_resize_raster_stack(729) INFO n_workers > 1 (2) so starting a processes pool.
2021-06-29 12:35:25,887 geoprocessing.align_and_resize_raster_stack(779) INFO 1 of 5 aligned: eto.tif
2021-06-29 12:35:30,457 geoprocessing.align_and_resize_raster_stack(779) INFO 2 of 5 aligned: precip.tif
2021-06-29 12:35:30,457 geoprocessing.align_and_resize_raster_stack(779) INFO 3 of 5 aligned: depth_to_root_rest_layer.tif
2021-06-29 12:35:30,459 geoprocessing.align_and_resize_raster_stack(779) INFO 4 of 5 aligned: pawc.tif
2021-06-29 12:35:30,999 geoprocessing.align_and_resize_raster_stack(779) INFO 5 of 5 aligned: clipped_lulc.tif
2021-06-29 12:35:31,082 geoprocessing.align_and_resize_raster_stack(788) INFO aligned all 5 rasters.
2021-06-29 12:35:31,230 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 17
2021-06-29 12:35:31,232 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 18
2021-06-29 12:35:31,232 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 19
2021-06-29 12:35:31,233 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 20
2021-06-29 12:35:31,233 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 21
2021-06-29 12:35:31,233 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 22
2021-06-29 12:35:31,234 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 23
2021-06-29 12:35:31,234 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 24
2021-06-29 12:35:31,236 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 25
2021-06-29 12:35:31,236 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 26
2021-06-29 12:35:31,237 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 27
2021-06-29 12:35:31,239 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 28
2021-06-29 12:35:31,240 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 29
2021-06-29 12:35:31,240 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 30
2021-06-29 12:35:31,240 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 31
2021-06-29 12:35:31,242 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 32
2021-06-29 12:35:31,242 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 33
2021-06-29 12:35:31,243 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 34
2021-06-29 12:35:31,243 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 35
2021-06-29 12:35:31,243 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 36
2021-06-29 12:35:31,244 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 37
2021-06-29 12:35:31,246 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 38
2021-06-29 12:35:31,246 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 39
2021-06-29 12:35:31,247 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 40
2021-06-29 12:35:31,249 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 41
2021-06-29 12:35:31,249 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 42
2021-06-29 12:35:31,250 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 43
2021-06-29 12:35:31,250 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 44
2021-06-29 12:35:31,250 utils.build_lookup_from_csv(479) WARNING Encountered an entirely blank row on line 45
2021-06-29 12:35:31,286 hydropower_water_yield.execute(236) DEBUG bio_lucodes set([’’, 11.0, 71.0, 41.0, 42.0, 43.0, 255.0, 81.0, 82.0, 52.0, 21.0, 22.0, 23.0, 24.0, 90.0, 31.0, 95.0])
2021-06-29 12:35:31,289 hydropower_water_yield._check_missing_lucodes(724) INFO Checking that input tables have landcover codes for every value in the landcover map.
2021-06-29 12:35:31,730 hydropower_water_yield.execute(278) INFO Reclassifying temp_Kc raster
2021-06-29 12:35:31,733 Task.add_task(636) ERROR Something went wrong when adding task create_Kc_raster (2), terminating taskgraph.
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\taskgraph\Task.py”, line 602, in add_task
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\taskgraph\Task.py”, line 1068, in _call
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 1747, in reclassify_raster
KeyError: ‘11.0’
2021-06-29 12:35:31,733 model._logged_target(1639) ERROR Exception while executing <function execute at 0x10ED2670>
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1636, in _logged_target
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\hydropower\hydropower_water_yield.py”, line 287, in execute
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\taskgraph\Task.py”, line 602, in add_task
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\taskgraph\Task.py”, line 1068, in _call
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 1747, in reclassify_raster
KeyError: ‘11.0’

has anyone else encountered this particular error before, and if so, how did you handle it?

Many thanks.

Hi @hollandmeg98 ,

Welcome to the forum!

Are you using the Annual Water Yield or the Seasonal Water Yield model? Key errors are common. Check that there is a value of 11.0 in your biophysical table, and add a row for it if it’s not already there. If a value is included in the land cover raster that is not included as a row in the biophysical table, you will receive this type of error.

Also check that there is not a value of 11.0 in your soil group raster. The values for soil groups for this model can only be 1, 2, 3, or 4, but sometimes there are other values assigned to soil groups. If this is what’s happening, you’ll need to reassign the soil group raster value of 11.0 to one of the allowed classes of 1 through 4. If this isn’t what’s happening, then please do ATTACH your log file (ending in extension .txt) here, rather than pasting its contents, so that we can look more closely.

Thanks,
Jesse

3 Likes

Hi Jesse,

Thanks for the quick response. I am using the Annual Water Yield Model.
I was able to fix this problem by removing unnecessary values from my biophysical table, and reassigning soil group values.

Have a great one.

3 Likes

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