# Thread: Calculating beta-diversity with raster data?

1. ## Calculating beta-diversity with raster data?

Hi folks, I'm trying to work out a method to calculate the "beta"-diversity given a Landsat vegetation classification -- essentially to determine how patterns of vegetation change across a landscape.

Unlike "richness" which could be easily calculated using focal stats ("variety"), I'm trying to determine how the composition of the classification changes in space. More on beta-diversity here: http://en.wikipedia.org/wiki/Beta_diversity (It's essentially a measure of similarity)

Theoretically this could be done using features and Python lists (searchcursor) -- eg. create a new list for each quadrant of the classifications values, for intance:

and then based on the location of the quadrants (lat-long), I could create a pseudo-moving window to compare the contents of each list for adjacent or nearby quadrants.

Problem is this is >1GB raster that I'm starting with (30m resolution), so conversion to shapefile and subsequent processing is going to be super-slow.

Any ideas as how to perform something akin to what I have described above using the spatial analyst tools? Unfortunately, I don't see a simple focal stats approach here... but perhaps I am missing something.

The other approach I've considered is creating raster dataset for each classification value and then using a local analysis, but unfortunately I run across the same limitation, which is actually implementing the beta-diversity algorithm/calculation...

Any thoughts would be greatly appreciated! For comparison the closest post on here I can find is:

2. ## Re: Calculating beta-diversity with raster data?

At its simplest, I'd like to create a list of values within quadrants (neighborhood/window) and then compare the contents of those lists.

The first step would be to create a list of values -- is that possible using spatial analyst?

3. ## Re: Calculating beta-diversity with raster data?

One additional approach, which might be more closely aligned with the available tools in Spatial Analyst is to reclassify the landcover classification in such a way that a focal sum could create unique outputs based on the values within the neighborhood window

e.g. quadrant1 (3 x 3 grid) = 100,000 + 10,000 + 1,000 + 100 + 10 + 1 = 111,111
quadrant2 = 10,000 + 10,000 + 1,000 + 100 + 100 + 10 = 21,210

such an approach would give both what amounts to a list of values and the relative abundance of each class.

From there, you could simply calculate a second focal stats using 'variety"...

4. ## Re: Calculating beta-diversity with raster data?

I'm realizing my 11 classes would require 64-bit data to perform the analysis described above,whereas the reclassify tool is obviously limited to 32-bit based maximum value(2147483648). Any suggestions?

Ideally the reclass would be as follows:
(input:output)
1:1
2:10
3:100
4:1000
5:10000
6:10000
.
.
.
11: 10000000000

I've considered using 32-bit float and using decimal places, but again reclassify outputs must be integers!

Thanks,
James

5. ## Re: Calculating beta-diversity with raster data?

A nested "Con" statement might do the trick... it can handle floats, right?

6. ## Re: Calculating beta-diversity with raster data?

There may be some effective work-arounds.

The usual way to cope with this is to create 11 binary indicator grids, one for each category. The stack of 11 focal sums gives the list of category counts in the neighborhoods. This requires creating 11 binary grids (which is fast) and doing their focal sums, then coping with the entire stack of 11 focal sums later on.

Another way is to do it in stages. If all you really need is the list of category counts in each neighborhood, we know there are only 92,378 possibilities (assuming nothing is NoData; otherwise, there are 167,960 possibilities), which is feasible to encode as integer categories. This suggests doing the work in two stages. Reclassify, say, categories 1 through 6 as 1, 10, ..., 100000 and categories 7 through 11 as 0. Perform focal sums to encode the counts. There are up to 5005 possible results. Reclassify the focal sums into the numbers 1..5005. (This is best done by joining a reclassification table that is computed by a script.) Then repeat, reclassifying categories 7 through 11 as 1, 10, ..., 10000 and categories 1 through 6 as 0. Reclassify the 2002 possible results. Then use 'combine' to give an overall summary (or simply multiply the second grid by, say, 10000 and add the first grid, then reclassify the resulting codes).