r.li.patchnum(1grass)
π r.li.patchnum (1grass) β¨
okay bestie, welcome to the GRASS User's Manual page for r.li.patchnum, and yes we're doing this together, grab a matcha π
πΈ NAME πΈ
r.li.patchnum β calculates the patch number index on a raster map, and it does it using a 4 neighbour algorithm. that's the whole gig, she's niche and she's booked π
π KEYWORDS π
raster, landscape structure analysis, patch index β iykyk π¦
β¨ SYNOPSIS β¨
r.li.patchnum
r.li.patchnum --help
r.li.patchnum input=name config=name output=name [--overwrite]
[--help] [--verbose] [--quiet] [--ui]
π Flags:
--overwriteβ allow output files to overwrite existing files (she will simply replace what's there, no cap, so be careful π)--helpβ prints the usage summary, like a lil cheat sheet π«Ά--verboseβ verbose module output, she talks more--quietβ quiet module output, she talks less--uiβ force launching GUI dialog, for when you want buttons instead of typing π
π§ Parameters:
input=name[required] β name of input raster mapconfig=name[required] β configuration fileoutput=name[required] β name for output raster map
all three are required, no skipping, no substitutions, we don't do that here β
π DESCRIPTION π
so r.li.patchnum calculates the "patch number index" as:
f(sample_area)= Patch_Number
the way that this index gets calculated?? it uses a 4 neighbour algorithm, which means diagonal cells are ignored when tracing a patch. like, four neighbours only, she doesn't look diagonally, periodt π
π NOTES π
- Do not use absolute path names for the
configandoutputfile/map parameters. just don't. absolute paths are not the vibe here. - 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 folderC:\Users\userxy\AppData\Roaming\GRASS8\r.li\output\(MS-Windows) or$HOME/.grass8/r.li/output/(GNU/Linux). pick your fighter π¦ - if the sample area contains only NULL values then it is considered to have zero patches. empty girlie = no patches, that's just the rule β¨
π EXAMPLES π
to calculate patch number 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.patchnum input=my_map conf=my_conf out=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.patchnum input=forests conf=movwindow7 out=forests_patchnum_mov7
r.univar forests_patchnum_mov7
Forest map (North Carolina sample dataset) example π²:
g.region raster=landclass96 -p
r.mapcalc "forests = if(landclass96 == 5, 1, null() )"
r.li.patchnum input=forests conf=movwindow7 out=forests_patchnum_mov7
# verify
r.univar forests_patchnum_mov7
r.to.vect input=forests output=forests type=area
d.mon wx0
d.rast forests_patchnum_mov7
d.vect forests type=boundary
π₯ SEE ALSO π₯
r.li(package overview) β the whole friend group π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)
academic citation but make it iconic π
π AUTHORS π
- Michael Shapiro - CERL (patch identification)
- Markus Metz (statistics)
π SOURCE CODE π
Available at: r.li.patchnum 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
okay and that's the page bestie π«Ά this is r.li.patchnum from the GRASS 8.5.0 Reference Manual, dated and versioned and copyrighted as Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 β she's iconic, she's maintained, she ate, no crumbs π
β¨πΈ
π¦ 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