Habitat Quality Relative Impact Calculation

Hi all,

I’ve been running the Habitat Quality model and have a question regarding the calculation of i_rxy and the distance-weighted threat raster (filtered_<r>.tif). The User’s Guide indicates i_rxy is a function of the maximum threat distance and the distance between the threat grid cell y and grid cell x. Figure 1 shows how i_rxy decays with distance, with it having a value of 1 at a distance of 0 from y.

After taking a look at the source code, it appears i_rxy is calculated by the create_decay_kernel function and is combined with the threat raster to calculate the distance-weighted threat raster. When calculating the decay kernel, first each value is calculated based on its distance from the center (i.e., the threat cell) and the decay type. Each value is then divided by the integrated sum of the kernel.

Why is this final division step included? It seems to not align with the equations shown in the User’s Guide, and leads to an unintuitive distance-weighted threat raster. With or without this step, the rank order of cells will be the same, but it seems a bit odd that a cell with a given threat would have a distance-weighted value less than the original threat raster. It does lead to the kernel having an integrated sum of 1, but again, that doesn’t seem to align with the User’s Guide.

Any clarity would be much appreciated!



Hello @dg34 ,

You are exactly right, the equations in the User’s Guide do not match the source code and have not since InVEST 3.3.0 when the documented approach was switched out for the convolution you identify, without having made a corresponding update to the user’s guide. As it turns out, we will be switching this back to the documented approach in the forthcoming InVEST 3.13.0 release, which will be out in the next week or two.

In the meantime, here is a development build that includes the corrected model: https://storage.googleapis.com/releases.naturalcapitalproject.org/invest/3.12.1.post164%2Bgd33ae165f/workbench/invest_3.12.1.post164%2Bgd33ae165f_workbench_win32_x64.exe

@dcdenu4, any other details you’d like to add here?



Hey @jdouglass,

Thanks for the quick reply. Good to know. I also have InVEST installed into a conda environment. It looks like I can use the wheels found here: [GCS Bucket Listing] to install the development build, correct?


1 Like

Yep! Although you’ll specifically want the wheels from the development build I mentioned, which can be found here: http://releases.naturalcapitalproject.org/?prefix=invest/3.12.1.post164+gd33ae165f/

You can also install the latest version from git directly (assuming you have a compiler installed) by using:

pip install "git+https://github.com/natcap/invest.git@d33ae165f9b6d36c275b37a77412d2f80efddae4#egg=natcap.invest"

Once the release is out, you’ll be able to install the package as normal using pip and/or conda.



Thanks @dg34 and @jdouglass!

I think everything was captured correctly with regards to the issue and upcoming changes. We opted to go back to the implementation indicated in the Users Guide because it’s a simpler approach, faster to run, and was what the original research / paper did that founded the model.

With InVEST 3.13.0 the User’s Guide will also add some clarifying language.



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