r.li.cwed(1grass)
π r.li.cwed β the GRASS manual page, but make it make sense π
okay bestie, gather round, because today we're talking about r.li.cwed(1grass) β that's the GRASS module that calculates contrast weighted edge density index on a raster map. yes it's a mouthful, yes the acronym is giving "I made this up at 2am", but it's actually iconic once you get it. π¦
KEYWORDS: raster, landscape structure analysis, patch index
β¨ SYNOPSIS β¨
like, the whole vibe, verbatim:
r.li.cwed
r.li.cwed --help
r.li.cwed input=name config=name path=name output=name [--overwrite]
[--help] [--verbose] [--quiet] [--ui]
π FLAGS π
--overwriteβ lets output files just go ahead and overwrite files that already exist. chaos mode, consented. π--helpβ prints the usage summary so you're not out here guessing.--verboseβ verbose module output. it talks more. we love a chatty module. π£οΈ--quietβ quiet module output. it shuts up. also valid, honestly. π€«--uiβ force launches the GUI dialog, for when clicking buttons is the move.
πΈ PARAMETERS πΈ
input=name[required] β name of the input raster map. the map. the main character.config=name[required] β configuration file.path=name[required] β name of the file that contains the weight used to calculate the index.output=name[required] β name for the output raster map.
no cap: all four of these are required, so don't come to the function empty-handed. π
π DESCRIPTION π
so r.li.cwed (contrast weighted edge density) calculates the edge density between patch types you specify. here's the whole thing, and the formula goes a little something like this:
with:
k: attributem: number of non-null attributes in the sampling areaeik: total length of edge in landscape between patch typesiandkdik: dissimilarity (edge contrast weight) between patch typesiandkArea: total landscape area
the input file has one row for each couple of patch types you want to consider in the calculation. every row gets saved using this exact syntax:
patchType1,patchType2,dissimilarityBetweenPatchType1andPatchType2
periodt. that's the format. don't freestyle it. β¨
π NOTES π
do NOT use absolute path names for theconfigandoutputfile/map parameters. I'm so serious. π
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\
(that's MS-Windows, bestie) or
$HOME/.grass8/r.li/output/
(that's GNU/Linux π).
also, important one: if the sample area contains only NULL values it's considered to have 0 patch and CWED=0. and if Area is 0, r.li.cwed returns -1. this is only possible if the map is masked.
if you want to change those -1 values to NULL, run this on the resulting map, after index calculation:
r.null setnull=-1 input=my_map
got it? run it subsequently. not before. after. π
π EXAMPLES π
to calculate the contrast weighted edge density 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.cwed input=my_map conf=my_conf output=my_out \
path=/path/to/weights.csv
and here's an example for the input "weights.csv" file, so you can see the whole row-of-three-thing in action:
12,16,0.65
44,123,0.32
56,12,0.54
23,66,0.99
see how it's just patch type, patch type, dissimilarity? yeah. slay. π
π SEE ALSO π
r.li(package overview)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)
- Markus Metz
π» SOURCE CODE π»
available at: r.li.cwed 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!! π«Ά full credit where it's due: Β© 2003-2026 GRASS Development Team, and this is the GRASS 8.5.0 Reference Manual β so if you're reading this on some other version, like, vibe check your install first. πβ¨π
π¦ 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