r.li.simpson(1)

πŸ’– r.li.simpson β€” Simpson's Diversity Index, but make it landscape πŸ’–

okay bestie, gather round, because this is the GRASS GIS module that goes viral for measuring how diverse your patches are. It's r.li.simpson, from the GRASS GIS User's Manual, and it's giving main character energy in landscape structure analysis. πŸ¦‹

KEYWORDS: raster, landscape structure analysis, diversity index


✨ SYNOPSIS ✨

r.li.simpson
r.li.simpson --help
r.li.simpson input=name config=name output=name  [--overwrite]  [--help]
[--verbose]  [--quiet]  [--ui]

πŸŽ€ Flags

  • --overwrite β€” lets your output files just bulldoze whatever was already there. Allow output files to overwrite existing files. πŸ’…
  • --help β€” prints the usage summary, i.e. the module explaining itself to you. Very self-aware of it.
  • --verbose β€” verbose module output. It will not stop talking and honestly? we love that. πŸ—£οΈ
  • --quiet β€” quiet module output. The introvert setting. 🀫
  • --ui β€” force launching the GUI dialog. For when you want the full graphic design moment. ✨

🌸 Parameters

  • input=name [required] β€” Name of input raster map. This is the map you're vibing with.
  • config=name [required] β€” Configuration file. Your settings, your rules.
  • output=name [required] β€” Name for output raster map. What you're naming your baby.

πŸ‘‘ DESCRIPTION πŸ‘‘

r.li.simpson calculates the "Simpson's diversity index" as:

with:

  • i: patch type
  • m: number of different patch types
  • pi: proportional abundance of patch type i

Like, that's the whole recipe. Count your patch types, weigh their abundances, and boom β€” diversity, quantified. πŸ“


🧚 NOTES 🧚

Do not use absolute path names for the config and output file/map parameters. Just don't, bestie. Relative paths only, no cap. 🚫

If the "moving window" method was selected in g.gui.rlisetup, then the output will be a raster map β€” otherwise an ASCII file will be generated in the folder:

C:\Users\userxy\AppData\Roaming\GRASS8\r.li\output\ (MS-Windows)

or

$HOME/.grass8/r.li/output/ (GNU/Linux)

Also, heads up: if the input raster map contains only NULL values, then r.li.simpson returns NULL. Empty in, empty out, that's just the vibe check failing. πŸ’€


🌈 EXAMPLES 🌈

To calculate Simpson's diversity index on map my_map, using my_conf configuration file (previously defined with g.gui.rlisetup) and saving results in my_out, run:

r.li.simpson input=my_map conf=my_conf output=my_out

Forest map (Spearfish sample dataset) example:

g.region raster=landcover.30m -p
r.mapcalc "forests = if(landcover.30m >= 41 && landcover.30m <= 43,1,null())"
r.li.simpson input=forests conf=movwindow7 out=forests_simpson_mov7
r.univar forests_simpson_mov7

Forest map (North Carolina sample dataset) example:

g.region raster=landclass96 -p
r.mapcalc "forests = if(landclass96 == 5, 1, null() )"
r.li.simpson input=forests conf=movwindow7 out=forests_simpson_mov7
# verify
r.univar forests_simpson_mov7
r.to.vect input=forests output=forests type=area
d.mon wx0
d.rast forests_simpson_mov7
d.vect forests type=boundary

πŸ’œ SEE ALSO πŸ’œ

  • r.li β€” package overview, and honestly your first stop
  • g.gui.rlisetup

πŸ“š REFERENCES πŸ“š

McGarigal, K., and B. J. Marks. 1995. FRAGSTATS: spatial pattern analysis program for quantifying landscape structure. USDA For. Serv. Gen. Tech. Rep. PNW-351. (PDF)


🫢 AUTHORS 🫢

Serena Pallecchi, student of Computer Science University of Pisa (Italy). Commission from Faunalia Pontedera (PI), Italy (www.faunalia.it)


⭐ SOURCE CODE ⭐

Available at: r.li.simpson source code (history)

Accessed: Saturday Jan 17 05:40:56 2026

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual


and that's the whole page, bestie β€” r.li.simpson(1) from GRASS 8.4.2, accessed Saturday Jan 17 05:40:56 2026. go forth and measure diversity, you absolute icon πŸ’–βœ¨

πŸ“¦ where this page comes from