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.
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.
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?
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.