Integration with Diversity.jl

EcoSISTEM is integrated with the Diversity package, so diversity measures can be calculated directly on an ecosystem - an Ecosystem is a Diversity metacommunity, with one subcommunity per grid cell.

See The basics of EcoSISTEM.jl for how to set one up; the example below builds a small one to measure.

Every grid cell is a subcommunity, including inactive ones - sea off a coastline, or a cell a Deactivate intervention has destroyed. That costs nothing for the metacommunity measures, which weight each subcommunity by its share of the total abundance and so give an empty cell zero weight; the partitioned results are identical whether or not the empty cells are there. But a subcommunity measure returns one row per cell, so on a small island in a large grid most of those rows describe empty sea, and an index of an empty community is not defined. Select the occupied cells before asking a per-cell question.

using Diversity

first(norm_sub_alpha(eco, 1.0), 5)   # subcommunity measures - one row per grid cell, 25 here
5×8 DataFrame
Rowdiv_typemeasureqtype_leveltype_namepartition_levelpartition_namediversity
StringStringFloat64StringStringStringStringFloat64
1UniqueNormalisedAlpha1.0typessubcommunity[0.0, 10.0) × [0.0, 10.0) km9.83906
2UniqueNormalisedAlpha1.0typessubcommunity[10.0, 20.0) × [0.0, 10.0) km9.96828
3UniqueNormalisedAlpha1.0typessubcommunity[20.0, 30.0) × [0.0, 10.0) km9.87023
4UniqueNormalisedAlpha1.0typessubcommunity[30.0, 40.0) × [0.0, 10.0) km9.93373
5UniqueNormalisedAlpha1.0typessubcommunity[40.0, 50.0) × [0.0, 10.0) km9.86444
norm_meta_alpha(eco, 1.0)     # or metacommunity measures - one row for the landscape
1×8 DataFrame
Rowdiv_typemeasureqtype_leveltype_namepartition_levelpartition_namediversity
StringStringFloat64StringStringStringStringFloat64
1UniqueNormalisedAlpha1.0typesmetacommunity9.91511

Any measure takes several values of the viewpoint parameter q at once - 0 counts rare and common species alike, and larger values weight towards the commonest:

beta = norm_sub_beta(eco, 0.0:3.0)   # one row per cell per q - 100 of them here
beta[beta.partition_name .== first(beta.partition_name), :]   # one cell, all four q
4×8 DataFrame
Rowdiv_typemeasureqtype_leveltype_namepartition_levelpartition_namediversity
StringStringFloat64StringStringStringStringFloat64
1UniqueNormalisedBeta0.0typessubcommunity[0.0, 10.0) × [0.0, 10.0) km1.0
2UniqueNormalisedBeta1.0typessubcommunity[0.0, 10.0) × [0.0, 10.0) km1.01635
3UniqueNormalisedBeta2.0typessubcommunity[0.0, 10.0) × [0.0, 10.0) km1.03165
4UniqueNormalisedBeta3.0typessubcommunity[0.0, 10.0) × [0.0, 10.0) km1.0457