# Water Yield - TypeError: ufunc 'isfinite'

**URL:** <https://community.naturalcapitalalliance.org/t/water-yield-typeerror-ufunc-isfinite/1330>\
**Category:** Software Support\
**Tags:** annual-water-yield\
**Created:** [September 12, 2020, 5:30pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-typeerror-ufunc-isfinite/1330 "2020-09-12T17:30:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![marco.guzzetti](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/marco.guzzetti/32/1252_2.png) [@marco.guzzetti](https://community.naturalcapitalalliance.org/u/marco.guzzetti)\
**Post date:** [September 12, 2020, 5:30pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-typeerror-ufunc-isfinite/1330/1 "2020-09-12T17:30:08Z")

</div>

Hello everyone,

I’m trying to run the Wayer Yield model, always receiving the TypeError: ufunc ‘isfinite’. I tried to use different versions of InVEST but this hasn’t helped.

I’ve read that other users had a similar problem in the past. I can confirm that I checked if I had no-data values and all my shapefiles are in the same coordinate system.

I attach here the logfile and my inputs (they are quite large)

Thank you for your help and assistance.

Marco[InVEST-Hydropower-Water-Yield-log-2020-09-12–19\_05\_43.txt|attachment]

In this link you’ll find a compressed folder with the needed data (check only the folder WaterYield please) [WaterYield - Google Drive](https://drive.google.com/drive/folders/1CZE3R7P3WOa-9bpp-lIv6VfBYJeis8iO?usp=sharing)

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [September 14, 2020, 2:34pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-typeerror-ufunc-isfinite/1330/2 "2020-09-14T14:34:34Z")

</div>

Hey @marco.guzzetti -

Would you please re-post the log file? It doesn’t seem to have attached. Thanks!

~ Stacie

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [September 14, 2020, 8:57pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-typeerror-ufunc-isfinite/1330/3 "2020-09-14T20:57:05Z")

</div>

I just looked at your data, and it looks like none of the spatial layers have a NoData value set, the “background” pixels are set to 0. I know this has caused a problem with models in the past, so one thing to try is setting a NoData value and see if that helps.

~ Stacie

---

<div class="post-metadata">

**Author:** ![jdouglass](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/jdouglass/32/9_2.png) [@jdouglass](https://community.naturalcapitalalliance.org/u/jdouglass)\
**Post date:** [September 14, 2020, 11:51pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-typeerror-ufunc-isfinite/1330/4 "2020-09-14T23:51:37Z")

</div>

Just to follow up on this, the undefined nodata value is almost certainly what’s causing it (this is something we’ve seen pretty regularly across a lot of InVEST models). Defining a nodata value should be all that’s needed to fix the issue for now, and then this case will be handled properly in InVEST 3.9.

---

<div class="post-metadata">

**Author:** ![marco.guzzetti](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/marco.guzzetti/32/1252_2.png) [@marco.guzzetti](https://community.naturalcapitalalliance.org/u/marco.guzzetti)\
**Post date:** [September 15, 2020, 2:30pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-typeerror-ufunc-isfinite/1330/5 "2020-09-15T14:30:29Z")

</div>

Hi @swolny and @jdouglass

thank you for your replies. I attach the log file.

Also, you are both saying that I should define a Nodata value, but I wonder whether I should assign another value different than 0.

Thank you [wy\_biophysical\_table\_lulc300.csv](https://community.naturalcapitalalliance.org/uploads/short-url/abAn8g7MKtJOAsZJvJLahHcFFnh.csv) (885 Bytes) both,  
Marco

---

<div class="post-metadata">

**Author:** ![marco.guzzetti](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/marco.guzzetti/32/1252_2.png) [@marco.guzzetti](https://community.naturalcapitalalliance.org/u/marco.guzzetti)\
**Post date:** [September 15, 2020, 2:30pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-typeerror-ufunc-isfinite/1330/6 "2020-09-15T14:30:52Z")

</div>

[InVEST-Hydropower-Water-Yield-log-2020-09-12–19\_05\_43.txt](https://community.naturalcapitalalliance.org/uploads/short-url/xX8J4MRHGv2F20wc69l9yG0to1.txt) (15.7 KB)

---

<div class="post-metadata">

**Author:** ![jdouglass](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/jdouglass/32/9_2.png) [@jdouglass](https://community.naturalcapitalalliance.org/u/jdouglass)\
**Post date:** [September 15, 2020, 4:46pm UTC](https://community.naturalcapitalalliance.org/t/water-yield-typeerror-ufunc-isfinite/1330/7 "2020-09-15T16:46:04Z")

</div>

Thanks for providing your logfile, Marco! In this case, the `isfinite` issue has to do with the fact that a nodata value isn’t defined at all. If a nodata value of 0 makes sense for your inputs, then it would be completely fine to use it as your nodata value.
