# SDR error: exception encountered in raster\_calculator

**URL:** <https://community.naturalcapitalalliance.org/t/sdr-error-exception-encountered-in-raster-calculator/3715>\
**Category:** Software Support\
**Tags:** sdr\
**Created:** [May 5, 2023, 7:58pm UTC](https://community.naturalcapitalalliance.org/t/sdr-error-exception-encountered-in-raster-calculator/3715 "2023-05-05T19:58:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![KLI](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/kli/32/2791_2.png) [@KLI](https://community.naturalcapitalalliance.org/u/KLI)\
**Post date:** [May 5, 2023, 7:58pm UTC](https://community.naturalcapitalalliance.org/t/sdr-error-exception-encountered-in-raster-calculator/3715/1 "2023-05-05T19:58:07Z")

</div>

I am trying to run the SDR model and I’ve been running into an error that seems to involve the raster\_calculator function. Looking around on these forums I had the impression that these might be related to how NA values are coded in my .tif rasters. I thought that this meant I should reclassify NA cells to not be based on 0, but this does not seem to have fixed things. Any insight on what the error messages might mean would be helpful. I’ve attached the log file.  
[InVEST-natcap.invest.sdr.sdr-log-2023-05-05–15\_51\_41.txt](https://community.naturalcapitalalliance.org/uploads/short-url/52cEArZtCG8eAncIh8X8roRbcvo.txt) (11.1 KB)

---

<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:** [May 8, 2023, 3:04pm UTC](https://community.naturalcapitalalliance.org/t/sdr-error-exception-encountered-in-raster-calculator/3715/2 "2023-05-08T15:04:58Z")

</div>

Hi @KLI -

If your NoData value is set, and you’ve verified that all of the values in your land use/land cover map have an entry in the biophysical table, then I’m not sure what’s causing this error. If you can send me your data I’ll take a look at it. The best way to do it is this:

1/ In InVEST Workbench, go to the tab where you’re entering your model inputs.  
2/ Click on “Save As…” in the left side of the screen.  
3/ In the “Datastack options” window that appears, click on “Parameters and data”.  
4/ Give the output file a name (leaving it as the default is fine too), and make sure that the file extension is “.tgz”.  
5/ Save the file and send it to me at swolny@stanford.edu

Thanks!

~ Stacie

---

<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 8, 2023, 3:16pm UTC](https://community.naturalcapitalalliance.org/t/sdr-error-exception-encountered-in-raster-calculator/3715/3 "2023-05-08T15:16:28Z")

</div>

Thanks for posting @KLI,

@swolny, looking at the log this looks a bit more complicated than a `nodata` / table issue I think. It very well could be an edge case bug in one of our functions.

@KLI if you’re able to, could you also share your data with me as well using the instructions Stacie provided. My email is ddenu@stanford.edu. Or Stacie could forward it along as well!

Thanks!

Doug

---

<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 9, 2023, 6:48pm UTC](https://community.naturalcapitalalliance.org/t/sdr-error-exception-encountered-in-raster-calculator/3715/4 "2023-05-09T18:48:35Z")

</div>

Hi @KLI,

Thanks for sharing your data, there is indeed a pretty neat bug in the model. The bug stems from the DEM raster input having a nodata value of `nan`. While we work on a general solution to the problem, a workaround would be defining a non `nan` nodata value to the DEM input. That should do it.

Please report back if you run into other issues!

Doug

---

<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 16, 2023, 6:48pm UTC](https://community.naturalcapitalalliance.org/t/sdr-error-exception-encountered-in-raster-calculator/3715/5 "2023-05-16T18:48:54Z")

</div>

Closed on May 16, 2023, 6:48pm UTC

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