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 theconfigandoutputfile/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 groupg.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
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms