Select to view content in your preferred language

Calculating diversity on a raster via a moving window

3860
2
03-01-2011 12:17 PM
TaylerHamilton
Emerging Contributor
Hello,

I have a raster data file of 18 different land cover classifications. I would like to calculate the land cover diversity using the Simpson diversity index:

Diversity = 1 - ??? sqr(P_i)

Where, "P" is the proportion of each land cover type within the neighbourhood and "i" is the different types of land cover.

The land cover data is displayed as unique values.

I would like to use a moving window of a specific neighbourhood size to calculate the diversity index.

So far, I have used focal statistics to calculate the variety (which I understand can represent the different number of land cover types within the area, or richness).

I was wondering, how do I determine the proportion (evenness) of each different land cover type within the same neighbourhoods? I was hoping I could calculate this and then use both results (variety and evenness) in the raster calculator to output the diversity model.

If anyone knows what I am talking about and can point me in the right direction, it would be VERY much appreciated!!!

Thank you,

Tayler
0 Kudos
2 Replies
AimeeSalstead
New Contributor
Hi Taylor,
I'm trying to do the same thing. Did you ever sort it out?
Aimee


I have a raster data file of 18 different land cover classifications. I would like to calculate the land cover diversity using the Simpson diversity index:

Diversity = 1 - �?? sqr(P_i)

Where, "P" is the proportion of each land cover type within the neighbourhood and "i" is the different types of land cover.


UPDATE: Moved thread to the Spatial Analyst forum.
0 Kudos
ShaunWalbridge
Esri Regular Contributor
There are a couple of ways to approach this. Probably the easiest is to stick with a pure Spatial Analyst approach to get what you're looking for, but another approach would be to convert your data into numpy arrays with RasterToNumpyArrays, which will give you access to each cell in a fine-grained way.

Just using Spatial Analyst, I've put together a script which makes the required calculations. The key trick is doing separate calculations for each class in your input raster, and then summing those results to convert the counts of each type into a proportion of the total. I've committed a script which computes all three on Github:

               Compute Simpson Diversity Indicies: simspon_index.py

I've tried to include both the equations via LaTeX and comments where possible. The current script is verbose, and performance could be improved (it takes about 90s on a 1m cell raster with 4 classes), but hopefully this gets you the landscape measurements you need.

cheers,
Shaun
0 Kudos