# Habitat Quality, output raster looks strange and output values have no intermediate values

**URL:** <https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977>\
**Category:** Software Support\
**Tags:** habitat-quality\
**Created:** [May 5, 2020, 1:07am UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977 "2020-05-05T01:07:35Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lara](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/lara/32/375_2.png) [@Lara](https://community.naturalcapitalalliance.org/u/Lara)\
**Post date:** [May 5, 2020, 1:07am UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/1 "2020-05-05T01:07:35Z")

</div>

Hi there! So, I’ve been here before… managed to solve my previous issues and got the model running successfully. The thing now is that I don’t like the output raster, it is not what I expected and it looks super weird, I don’t know how to describe it so I attach it here for you to see. Also, the output values look weird, since I have 0, .99 and 1 and a LOT of values of .99something, but that is it, I don’t have anything in between. I honestly don’t know what is going on and I would greatly appreciate it if any of you could give me some guidance to improve my output. I’m attaching all necessary files for you to see (input tables, output raster and log). Thanks in advance!  
[InVEST-Habitat-Quality-log-2020-04-23–01\_15\_03.txt](https://community.naturalcapitalalliance.org/uploads/short-url/lo2DIHbK5MAndJsSA2LbZVQdTb7.txt) (120.6 KB) [Sensitivity.csv](https://community.naturalcapitalalliance.org/uploads/short-url/eY8IR1jlYnGsNJMJC5dzckQNiQD.csv) (432 Bytes) [Threats.csv](https://community.naturalcapitalalliance.org/uploads/short-url/tjDE7X9qz32pIFJPkGgbkpZDnre.csv) (262 Bytes)

---

<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 5, 2020, 12:53pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/2 "2020-05-05T12:53:51Z")

</div>

Hi @Lara

Thanks for posting. It looks like you uploaded the log file and the two input CSV files. I don’t see your output rasters though. Could you upload those as well? If they are too big you could also share them via dropbox, google drive, or your preferred way to share files online.

Best,

Doug

---

<div class="post-metadata">

**Author:** ![Lara](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/lara/32/375_2.png) [@Lara](https://community.naturalcapitalalliance.org/u/Lara)\
**Post date:** [May 5, 2020, 6:52pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/3 "2020-05-05T18:52:32Z")

</div>

Yes I’m sorry about that. Apparently the TIF file is too large (10.6MB) to upload it here. Is there any other way I can send it to you?  
Thank you so much for your fast response.

---

<div class="post-metadata">

**Author:** ![Lara](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/lara/32/375_2.png) [@Lara](https://community.naturalcapitalalliance.org/u/Lara)\
**Post date:** [May 5, 2020, 6:56pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/4 "2020-05-05T18:56:18Z")

</div>

OK I uploaded the TIF files and associated files (not sure if you need this to open the TIF in a GIS so I just droped everthing in there).

Let me know if you can access:

[https://drive.google.com/open?id=1-SMeOT8yOD0tew7yPnw-2iOHH6YfEne-](https://drive.google.com/open?id=1-SMeOT8yOD0tew7yPnw-2iOHH6YfEne-)

---

<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 6, 2020, 12:51pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/5 "2020-05-06T12:51:23Z")

</div>

Hi Lara,

I was able to download the files, thanks. I’ll take a look today.

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 6, 2020, 7:58pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/6 "2020-05-06T19:58:35Z")

</div>

Hi @Lara,

You’re outputs look OK from a software perspective. Do you think you could also share your threat rasters and LULC? It just seems like given the weights and sensitivity values for the threats, and the decay over distance, that the impact is appearing small.

Do you think that you could give a brief description on what you’re modeling for biodiversity? It might help with thinking about the weights and sensitivity values.

Best,

Doug

---

<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 6, 2020, 8:24pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/7 "2020-05-06T20:24:10Z")

</div>

Hey @dcdenu4 -

Just chiming in here that I’ve seen similar behavior before, including even with our sample data, and I’m pretty sure that older versions of InVEST output more of a spread of values, as one would expect. It would be great if you can check it out, the Willamette sample data will show similar behavior, and if @Lara can provide another test case, that would be great to have.

~ Stacie

---

<div class="post-metadata">

**Author:** ![Lara](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/lara/32/375_2.png) [@Lara](https://community.naturalcapitalalliance.org/u/Lara)\
**Post date:** [May 6, 2020, 9:18pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/8 "2020-05-06T21:18:27Z")

</div>

Ok, I just uploaded two folders to the drive, they contain the LULC raster and threat rasters: [https://drive.google.com/open?id=1-SMeOT8yOD0tew7yPnw-2iOHH6YfEne-](https://drive.google.com/open?id=1-SMeOT8yOD0tew7yPnw-2iOHH6YfEne-)

So, about biodiversity, I’m not exactly modeling for a particular group of organisms, but my main focus of interest is the riparian corridor, since most threats concentrate in this area. So my objective is to define how HQ distributes along the riparian corridor based on all those threats. Not sure if this makes sense. Maybe my approach is mistaken.

Thank you for your input. I would really like to improve this model.

---

<div class="post-metadata">

**Author:** ![Lara](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/lara/32/375_2.png) [@Lara](https://community.naturalcapitalalliance.org/u/Lara)\
**Post date:** [May 6, 2020, 9:24pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/9 "2020-05-06T21:24:26Z")

</div>

Hi! Thank you so much for your intervention in this. I remember last year when I first asked for help in this community one of the first thing they told me was to make sure I was using the latest InVEST version, and that is what I’m doing (using version 3.8.0). Do you mean that maybe an older version could give me a better result in this case?

Another thing, I’m not exactly sure what you mean by “another test case”, do yo mean use my data as sample data on InVEST tutorials or something like that?

Thank you so much for your input. I’m eager to improve this.

---

<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 6, 2020, 9:48pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/10 "2020-05-06T21:48:09Z")

</div>

Hi @Lara -

I don’t usually recommend using older versions of InVEST, and don’t know how much Habitat Quality has changed in the last few revisions. But it would be interesting to see if you got results that are more as expected with older versions - 3.7, perhaps 3.6, I don’t think I’d go back much further than that, if you feel like giving it a try.

The comment about “test case” was for @dcdenu4, if he’s able to look into why the results are this way, he can check out both our sample data and your data. So it’s just for debugging purposes inside of NatCap. I’d never redistribute or display your data without getting permission from you first! And our sample data is ok for its purpose.

~ Stacie

---

<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 7, 2020, 12:37am UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/11 "2020-05-07T00:37:20Z")

</div>

@swolny, this also rings a bell from a conversation we had on slack where I think you suggested that the `half_saturation_constant` parameter influences the spread of values in the output rasters. And then I found this guidance from the user’s guide:

“In general, you want to set k (the half saturation constant) to half of the highest grid cell degradation value on the landscape. To perform this model calibration you will have to the run the model once to find the highest degradation value and set k for your landscape.”

---

<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 7, 2020, 12:19pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/12 "2020-05-07T12:19:29Z")

</div>

Thanks @swolny and @dave for the input here.

@Lara I completely forgot about the calibration recommendation that @dave brought up. Could you try this and see if it provides more reasonable results?

We are in the middle of giving this model some attention internally so it’d be great to find out if something is indeed bugged with the model before our next big release.

Thanks!

Doug

---

<div class="post-metadata">

**Author:** ![Lara](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/lara/32/375_2.png) [@Lara](https://community.naturalcapitalalliance.org/u/Lara)\
**Post date:** [May 8, 2020, 4:04am UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/13 "2020-05-08T04:04:45Z")

</div>

Ok, thanks so much everybody!

So, I tried both options, I ran the model on invest 3.8 with K factor 0.03 (got that from my degradation raster) just as @dave suggested. I like this raster better than the previous one because I have more intermediate HQ values now (0.1, 0.5, 0.7, etc), but I’m still not loving the display, I just thought the output would look a little bit more like the LULC raster. Also, when I try to display the unique values I get an error in mi GIS that says the number of values reached the limit, so I can’t visualize it like that. You can check the output rasters and log here:  
[https://drive.google.com/open?id=16MGFWCGOsflkJop--SsI6e1HSXprRzFP](https://drive.google.com/open?id=16MGFWCGOsflkJop--SsI6e1HSXprRzFP)

The second thing I did was run the model on a previous Invest version (3.7) as @swolny suggested, using same K value (0.03). This output I like less since I only got 0.0 values (0.001, 0.005, etc) and when I display the unique values the whole raster looks weird, it just looks wrong, I don’t know how to describe it. You can check the output rasters and log here:  
[https://drive.google.com/open?id=12ssnnTVwUSeAUiTKXAyYoeyhgTlfnvTf](https://drive.google.com/open?id=12ssnnTVwUSeAUiTKXAyYoeyhgTlfnvTf)

I’m not exactly sure what I’m doing wrong but I suspect it might be related to the fact that I have 5 habitats and I’m only entering data for three of these, could this be it?  
Honestly I have no idea. But thanks so much for your suggestions. I think changing the K value improved the output a little.

Do you have any other ideas on what I could do next? I’m all ears.

Lara

---

<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, 2020, 1:04pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/14 "2020-05-08T13:04:28Z")

</div>

Hi Lara,

The output rasters will be floating point values that will make it impossible (or realistically impossible) to display as unique values, like say an integer LULC raster. You could set a number of bins via symbology in QGIS for the outputs rasters, binning values 1 - 0.9, 0.9 - 0.8, 0.8 - 0.7, etc… would give you a similar unique view. Pixels that weren’t identified as habitat will have a value of 0 in `quality_out_c.tif`.

If you have 5 LULC values that are identified as habitats and just want to get a general indication of habitat quality for those, then I think what you’re doing sounds fine. The User’s Guide mentions the different cases of running the model for general habitat quality purposes or to look closely at a specific species.

I think a lot of people use this model with a future land use land cover where different scenarios might have taken place, like more development, business as usual, or conservation perhaps. So that future scenarios can be compared to the current via the habitat quality outputs.

@swolny you might have more experience with what and how people tend to use the model outputs.

Best,

Doug

---

<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, 2020, 2:21pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/15 "2020-05-08T14:21:53Z")

</div>

Honestly, I haven’t used Habitat Quality much myself so don’t have wisdom about its usage to share. But I can point you to a study that was done by colleagues at WWF, which used habitat quality to look at tiger habitat, including doing calibration against observations:

Bhagabati et al. 2014, Ecosystem services reinforce Sumatran tiger conservation in land use plans  
[http://dx.doi.org/10.1016/j.biocon.2013.11.010](http://dx.doi.org/10.1016/j.biocon.2013.11.010)

There may be others too, @Lara, it could be useful to [search through our publications database](https://naturalcapitalproject.stanford.edu/publications).

~ Stacie

---

<div class="post-metadata">

**Author:** ![Lara](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/lara/32/375_2.png) [@Lara](https://community.naturalcapitalalliance.org/u/Lara)\
**Post date:** [May 8, 2020, 6:03pm UTC](https://community.naturalcapitalalliance.org/t/habitat-quality-output-raster-looks-strange-and-output-values-have-no-intermediate-values/977/16 "2020-05-08T18:03:48Z")

</div>

Hi guys!

I will try the QGIS process @dcdenu4 is suggesting and will take a look at other publications to find out how other researchers are using this model, as @swolny is pointing. Will get back to you if other issues arise in the process.

Thank you all so much for your support and input on this.

Best

Lara
