# Water yield key error

**URL:** <https://community.naturalcapitalalliance.org/t/water-yield-key-error/2757>\
**Category:** Software Support\
**Tags:** annual-water-yield\
**Created:** [May 2, 2022, 12:58am UTC](https://community.naturalcapitalalliance.org/t/water-yield-key-error/2757 "2022-05-02T00:58:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yajiaoban](https://avatars.discourse-cdn.com/v4/letter/y/58956e/32.png) [@yajiaoban](https://community.naturalcapitalalliance.org/u/yajiaoban)\
**Post date:** [May 2, 2022, 12:58am UTC](https://community.naturalcapitalalliance.org/t/water-yield-key-error/2757/1 "2022-05-02T00:58:31Z")

</div>

Hi,everyone,  
I’ve met a problem about the Water Yield Model, about the value error as follows,  
biophysical\_table\_path C:/Users/huang/Desktop/Graduation/materials and data/InVEST\_tgr/water\_yield/biophysical table.csv  
depth\_to\_root\_rest\_layer\_path C:/Users/huang/Desktop/Graduation/materials and data/InVEST\_tgr/water\_yield/root.tif  
do\_scarcity\_and\_valuation False  
eto\_path C:/Users/huang/Desktop/Graduation/materials and data/InVEST\_tgr/water\_yield/ETO.tif  
lulc\_path C:/Users/huang/Desktop/Graduation/materials and data/InVEST\_tgr/water\_yield/landuse.tif  
n\_workers -1  
pawc\_path C:/Users/huang/Desktop/Graduation/materials and data/InVEST\_tgr/water\_yield/pawc.tif  
precipitation\_path C:/Users/huang/Desktop/Graduation/materials and data/InVEST\_tgr/water\_yield/rain.tif  
results\_suffix 2020  
seasonality\_constant 15  
sub\_watersheds\_path C:/Users/huang/Desktop/Graduation/materials and data/InVEST\_tgr/water\_yield/shp/subwatershed.shp  
watersheds\_path C:/Users/huang/Desktop/Graduation/materials and data/InVEST\_tgr/water\_yield/shp/watershed.shp  
workspace\_dir C:\Users\huang\Desktop\Graduation\materials and data\InVEST\_tgr\water\_output

2022-05-01 20:34:32,190 hydropower\_water\_yield.execute(101) INFO Validating arguments  
2022-05-01 20:34:32,237 validation.\_wrapped\_validate\_func(148) DEBUG Validation warnings: []  
2022-05-01 20:34:32,269 geoprocessing.align\_and\_resize\_raster\_stack(729) INFO n\_workers \> 1 (2) so starting a processes pool.  
2022-05-01 20:34:42,832 geoprocessing.align\_and\_resize\_raster\_stack(779) INFO 1 of 5 aligned: eto\_2020.tif  
2022-05-01 20:34:47,096 geoprocessing.align\_and\_resize\_raster\_stack(779) INFO 2 of 5 aligned: precip\_2020.tif  
2022-05-01 20:34:55,456 geoprocessing.align\_and\_resize\_raster\_stack(779) INFO 3 of 5 aligned: depth\_to\_root\_rest\_layer\_2020.tif  
2022-05-01 20:35:04,342 geoprocessing.align\_and\_resize\_raster\_stack(779) INFO 4 of 5 aligned: pawc\_2020.tif  
2022-05-01 20:35:07,857 geoprocessing.align\_and\_resize\_raster\_stack(779) INFO 5 of 5 aligned: clipped\_lulc\_2020.tif  
2022-05-01 20:35:07,982 geoprocessing.align\_and\_resize\_raster\_stack(788) INFO aligned all 5 rasters.  
2022-05-01 20:35:08,170 utils.build\_lookup\_from\_csv(471) WARNING Encountered an entirely blank row on line 10  
2022-05-01 20:35:08,184 utils.build\_lookup\_from\_csv(471) WARNING Encountered an entirely blank row on line 11  
2022-05-01 20:35:08,184 utils.build\_lookup\_from\_csv(471) WARNING Encountered an entirely blank row on line 12  
2022-05-01 20:35:08,184 hydropower\_water\_yield.execute(236) DEBUG bio\_lucodes set([’’, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 0.0])  
2022-05-01 20:35:08,184 hydropower\_water\_yield.\_check\_missing\_lucodes(724) INFO Checking that input tables have landcover codes for every value in the landcover map.  
2022-05-01 20:35:11,388 hydropower\_water\_yield.execute(278) INFO Reclassifying temp\_Kc raster  
2022-05-01 20:35:11,404 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: ‘0.0’  
2022-05-01 20:35:11,404 model.\_logged\_target(1640) ERROR Exception while executing \<function execute at 0x10EBC530\>  
Traceback (most recent call last):  
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1637, 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: ‘0.0’  
2022-05-01 20:35:11,404 model.\_logged\_target(1643) INFO Execution finished  
2022-05-01 20:35:11,404 utils.prepare\_workspace(115) INFO Elapsed time: 39.21s

If someone can solve the problem, I will be very grateful for that, thanks.  
The error details file is also attached.  
[InVEST-Hydropower-Water-Yield-log-2022-05-01–20\_34\_32.txt](https://community.naturalcapitalalliance.org/uploads/short-url/5iaaXGPrBgyjk9lY6ZnHTGUgnRh.txt) (4.7 KB)

---

<div class="post-metadata">

**Author:** ![dcdenu4](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dcdenu4/32/544_2.png) [@dcdenu4](https://community.naturalcapitalalliance.org/u/dcdenu4)\
**Post date:** [May 2, 2022, 1:02pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-key-error/2757/2 "2022-05-02T13:02:50Z")

</div>

Hi @yajiaoban,

Thanks for including your log file with the post. The `KeyError: 0.0` means that either the LULC input raster or the associated biophysical table do not recognize 0.0. Does your LULC raster have 0.0 values and does your table have a row to handle them? Sometimes we see this when the LULC rasters `nodata` value is not set.

I also see you’re using a development version of InVEST 3.6.0. We would strongly recommend updating to the latest version of [InVEST 3.10.2](https://naturalcapitalproject.stanford.edu/software/invest). Many bugfixes and updates have been made across the software.

Best,

Doug

---

<div class="post-metadata">

**Author:** ![yajiaoban](https://avatars.discourse-cdn.com/v4/letter/y/58956e/32.png) [@yajiaoban](https://community.naturalcapitalalliance.org/u/yajiaoban)\
**Post date:** [May 2, 2022, 5:17pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-key-error/2757/3 "2022-05-02T17:17:58Z")

</div>

Thanks, Doug, the problem has been resolved, thanks very much.

dcdenu4 via Natural Capital Project Online Community \<[notifications@naturalcapitalproject.discoursemail.com](mailto:notifications@naturalcapitalproject.discoursemail.com)\> 于2022年5月2日周一 09:12写道：

---

<div class="post-metadata">

**Author:** ![yajiaoban](https://avatars.discourse-cdn.com/v4/letter/y/58956e/32.png) [@yajiaoban](https://community.naturalcapitalalliance.org/u/yajiaoban)\
**Post date:** [May 2, 2022, 10:41pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-key-error/2757/4 "2022-05-02T22:41:43Z")

</div>

Sorry, I have another question, that is, does the input of raster images with different resolutions have any effect on the final result of the model, and is it necessary to standardize the resolution before data input?

thanks，

jin huang \<[huangjinjin0210@gmail.com](mailto:huangjinjin0210@gmail.com)\> 于2022年5月2日周一 13:17写道：

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [May 3, 2022, 12:52pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-key-error/2757/5 "2022-05-03T12:52:01Z")

</div>

> [@yajiaoban](#):
>
> does the input of raster images with different resolutions have any effect on the final result of the model, and is it necessary to standardize the resolution before data input?

Good question, the model standardizes and aligns all of the raster inputs for you, using the LULC raster input as the basis for the resolution, and a “nearest neighbor” resampling method. If you wish to have more control over the resampling methods used, you could certainly do this step yourself beforehand.
