r.li.simpson(1grass)

πŸ’– r.li.simpson(1grass) β€” the whole vibe πŸ’–

okay bestie, so this is r.li.simpson, a GRASS manual page, and it is literally about calculating Simpson's diversity index on a raster map. yes. that Simpson. the diversity one. πŸ¦‹

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 output files just. overwrite existing files. no respect for the old ones, periodt πŸ’…
  • --help β€” prints the usage summary, aka the "what do I even type" moment
  • --verbose β€” verbose module output, so it tells you everything it's doing, main character energy
  • --quiet β€” quiet module output, the "don't talk to me rn" setting 🀫
  • --ui β€” force launches the GUI dialog, for when clicking > typing

🫢 Parameters: 🫢

  • input=name β€” required. name of input raster map. the map you're vibing with πŸ—ΊοΈ
  • config=name β€” required. configuration file. yes you need one.
  • output=name β€” required. name for output raster map.

✨ DESCRIPTION ✨

r.li.simpson calculates the "Simpson's diversity index" β€” that's the phrase, quoted like that, in the original β€” as:

with:

  • i: patch type πŸ“
  • m: number of different patch types
  • pi: proportional abundance of patch type i

(yes, the page really does hand you an "as:" and then a "with:" and then just the variable list. that's the whole setup. it's giving mysterious. iykyk πŸ”₯)


🌈 NOTES 🌈

πŸ’€ Do NOT use absolute path names for the config and output file/map parameters. fr fr. just don't.

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

  • C:\Users\userxy\AppData\Roaming\GRASS8\r.li\output\ on MS-Windows πŸͺŸ
  • $HOME/.grass8/r.li/output/ on GNU/Linux 🐧

Also! If the input raster map contains only NULL values, then r.li.simpson returns NULL. that's it. that's the answer. nothing. NULL. 😭


πŸ’œ EXAMPLES πŸ’œ

the basic one 🧚

want Simpson's diversity index on map my_map, using my_conf config file (which you 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 🌲

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 🌳

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

not me noticing the examples use conf= and out= while the synopsis says config= and output= β€” both spellings show up in the original and i am simply reporting the receipts πŸ‘‘πŸ’…


🌟 SEE ALSO 🌟

  • r.li (package overview) β€” the whole family, go meet them
  • 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)

Latest change: Friday Apr 17 01:04:26 2026 in commit: 32a143358df26b2e518b03c7e0d79541e8d1e5b1

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

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual


and that's the page, bestie β€” this was GRASS 8.5.0, r.li.simpson(1grass), go forth and index some diversity πŸŒΈπŸ¦‹βœ¨πŸ«Ά

πŸ“¦ where this page comes from