# SWY error: exception encountered in raster\_calculator

**URL:** <https://community.naturalcapitalalliance.org/t/swy-error-exception-encountered-in-raster-calculator/3753>\
**Category:** Software Support\
**Tags:** seasonal-water-yield\
**Created:** [May 15, 2023, 6:07pm UTC](https://community.naturalcapitalalliance.org/t/swy-error-exception-encountered-in-raster-calculator/3753 "2023-05-15T18:07:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JENN](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@JENN](https://community.naturalcapitalalliance.org/u/JENN)\
**Post date:** [May 15, 2023, 6:07pm UTC](https://community.naturalcapitalalliance.org/t/swy-error-exception-encountered-in-raster-calculator/3753/1 "2023-05-15T18:07:59Z")

</div>

Hello everyone,

I’m trying to run SWY model, and have a same problem with " exception encountered in raster\_calculator"([SDR error: exception encountered in raster\_calculator](https://community.naturalcapitalalliance.org/t/sdr-error-exception-encountered-in-raster-calculator/3715/2)). I’ve confirmed LULC data have an entry in the biophysical table, so I tried to reclassify all of other RASTER’s NA cells to -1 by using “Reclassify” and “Raster Calculator-with formula of Con(IsNull(“eto\_1”),-1,“eto\_1”)” in ArcGIS (Reference to [Warning ” Raster has undefined NODATA value” in InVEST 3.11.0 Workbench](https://community.naturalcapitalalliance.org/t/warning-raster-has-undefined-nodata-value-in-invest-3-11-0-workbench/2937)), but I find the result was similar to my previous input data, only with NODATA at the boundary!  
So I would like to ask if the NODATA value at the boundary may be the key impact of happens " exception encountered in raster\_calculator" problem when running InVEST??  
(That’s mean maybe I need to clip the interest area before run the model, putting back the consideration of continuity of the surrounding terrain?? also I have read hydro DEM guide, there is suggestions in step7 to **Clip the DEM to your study area** but still a little bit confused)

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/9/9aa159a078835d400b11e156d38adb56d6491275.jpeg)  
(The pink area means NODATA)

Looking forward to any experiences shared by members of the community, thanks all.  
And also I will continue to try and error until it works.

[InVEST-natcap.invest.seasonal\_water\_yield.seasonal\_water\_yield-log-2023-05-15–02\_21\_00.txt](https://community.naturalcapitalalliance.org/uploads/short-url/oLNjHVvGPDViH7b7enNNwMYg7EV.txt) (4.3 MB)

---

<div class="post-metadata">

**Author:** ![esoth](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@esoth](https://community.naturalcapitalalliance.org/u/esoth)\
**Post date:** [May 16, 2023, 6:15pm UTC](https://community.naturalcapitalalliance.org/t/swy-error-exception-encountered-in-raster-calculator/3753/2 "2023-05-16T18:15:50Z")

</div>

@JENN ,  
This is an overflow error happening in the quickflow equation where we calculate \exp\left( - \frac{0.2S\_{i}}{a\_{i,m}} \right). An overflow error means that the result is such a large number that the software can’t store it. This should not happen with normal data.

Are you sure that your nodata values are set correctly? It seems like either S\_{i} or a\_{i,m} is negative, which it should not be.

---

<div class="post-metadata">

**Author:** ![JENN](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@JENN](https://community.naturalcapitalalliance.org/u/JENN)\
**Post date:** [May 17, 2023, 8:49am UTC](https://community.naturalcapitalalliance.org/t/swy-error-exception-encountered-in-raster-calculator/3753/3 "2023-05-17T08:49:10Z")

</div>

@esoth Thankyou for your reply. I have tried to double-check the NODATA value in my data, and it seems like an extremely small value. But when I using “Reclassify” and “Raster Calculator-with formula of Con(IsNull(“tif”),-1,“tif”)” in ArcGIS(reference to [GIS guide for nodata](https://gis.stackexchange.com/questions/159826/removing-nodata-value-from-raster-images/159832#159832)). There is no question about using a command “Reclassify” for integer data, but floating point data by using “Raster Calculator" seems like the same(pic 1), so I can only reset the NODATA value when export raster data. (pic 2, for example my DEM is between 3942 to -1.5032230615616 so I set “NoData as -3” in the while.)

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/9/99659b8c6a3da9ee6b2bf360d323533dfe469810.png)  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/8/8671814f03908d00fe550360a44bfae82c60150c.png)

When I opened this new TIFF ,the properties of the data (pic 3) seems like reset to -3 successfully, so this is my new inputdata.

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/b/b1f89dca606451d91a1bdc10bb92467ad2bae7f1.png)

Or, is it possible that the above steps did not actually reset NODATA successfully?

I look forward to any feedback, and again, thank you for your help. At the same time I will see if others on the forum have the same problem!

---

<div class="post-metadata">

**Author:** ![JENN](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@JENN](https://community.naturalcapitalalliance.org/u/JENN)\
**Post date:** [May 19, 2023, 6:17pm UTC](https://community.naturalcapitalalliance.org/t/swy-error-exception-encountered-in-raster-calculator/3753/4 "2023-05-19T18:17:00Z")

</div>

I tried to search for a solution by using “overflow error” as a keyword and fixed it. And also corrected the weird values for precipitation and evapotranspiration that maybe comes from Kriging. And I’m so glad it finally works! Thanks for @esoth helping me to identify the key problem.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/8/8d95591aa074da87ea0fdd61ca47c1c3c0588aa7.png) [@system](https://community.naturalcapitalalliance.org/u/system)\
**Post date:** [May 26, 2023, 6:17pm UTC](https://community.naturalcapitalalliance.org/t/swy-error-exception-encountered-in-raster-calculator/3753/5 "2023-05-26T18:17:09Z")

</div>

Closed on May 26, 2023, 6:17pm UTC

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