r.li.richness(1grass)

πŸ’– r.li.richness β€” the manual, but make it make sense πŸ’–

okay bestie, gather round, because this one is a raster girlie situation and I need you to be seated for it. This is r.li.richness, from the GRASS User's Manual, and it does one thing and it does it gorgeously.


✨ NAME ✨

r.li.richness β€” calculates the richness index on a raster map. that's it, that's the girl. πŸ’…

πŸŽ€ KEYWORDS πŸŽ€

raster, landscape structure analysis, diversity index. yes, she's niche. yes, she's iconic.


🌸 SYNOPSIS 🌸

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

πŸ¦‹ Flags:

  • --overwrite β€” let your output files bully existing files out of the way. overwrite energy. allow output files to overwrite existing files, basically.
  • --help β€” prints the usage summary, aka the tl;dr.
  • --verbose β€” verbose module output. she talks more. we love a yapper.
  • --quiet β€” quiet module output. she says nothing. mysterious. main character.
  • --ui β€” force launching the GUI dialog. for when you want the ✨aesthetic✨ version.

🌈 Parameters:

  • input=name β€” [required] name of input raster map.
  • config=name β€” [required] configuration file.
  • output=name β€” [required] name for output raster map.

πŸ’œ DESCRIPTION πŸ’œ

So. r.li.richness calculates the "richness diversity index" as:

with:

  • m: number of different patch types

that's literally the whole math drop. no cap. 🫢


πŸ‘‘ NOTES πŸ‘‘

okay this is the part where you LISTEN to me:

Do not use absolute path names for the config and output file/map parameters. I'm serious. not even a little bit.

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)

πŸ’€ yes, the Windows path is that cursed. i don't make the rules.

Also: if the input raster map contains only NULL values, then r.li.richness returns 0. that's the vibe check and it failed. 😭


πŸ“ EXAMPLES πŸ“

Wanna calculate the richness diversity index on map my_map, using the my_conf configuration file (which you previously defined with g.gui.rlisetup) and saving the results in my_out? Obsessed. Run:

r.li.richness 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.richness input=forests conf=movwindow7 out=forests_richness_mov7
r.univar forests_richness_mov7

🧚 Forest map (North Carolina sample dataset) example:

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

see the # verify line? she's checking her work. as she should. πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

  • r.li (package overview) β€” the whole friend group
  • g.gui.rlisetup β€” where you set the config up in the first place

⭐ 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)

yes we cite our sources. academic baddie behaviour. πŸŽ€


🌈 AUTHORS 🌈

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

shoutout Serena, absolute legend. 🫢


πŸ’» SOURCE CODE πŸ’»

Available at: r.li.richness 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


and that's the whole page, bestie. πŸ¦‹

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual β€” mwah, love that for us. now go calculate some richness. periodt. πŸ’–βœ¨

πŸ“¦ where this page comes from