r.li.mpa(1)

πŸ’– r.li.mpa πŸ’–

okay bestie, welcome to the GRASS GIS User's Manual page for r.li.mpa(1) β€” yes that's the manual name, and yes we're gonna read it together, it's fine, it's fun, I promise 🫢


✨ NAME ✨

r.li.mpa β€” it calculates the mean pixel attribute index on a raster map. that's the whole job. she's a specialist. she does one thing and she does it gorgeously πŸ’…


🌸 KEYWORDS 🌸

raster, landscape structure analysis, patch index

iykyk 🧚


🌈 SYNOPSIS 🌈

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

πŸŽ€ Flags πŸŽ€

  • --overwrite β€” lets output files overwrite files that already exist. yes she will absolutely bulldoze your old file, no cap πŸ’€
  • --help β€” prints the usage summary. the classic "what does this do again" button πŸ₯Ί
  • --verbose β€” verbose module output. she talks more. love that for her πŸ’¬
  • --quiet β€” quiet module output. she talks less. also love that for her 🀫
  • --ui β€” forces the GUI dialog to launch. point-and-click era ✨

πŸ’œ Parameters πŸ’œ

  • input=name [required] β€” name of input raster map. mandatory bestie, no skipping πŸ“Œ
  • config=name [required] β€” configuration file. also mandatory πŸ“Œ
  • output=name [required] β€” name for output raster map. still mandatory πŸ“Œ

πŸ¦‹ DESCRIPTION πŸ¦‹

r.li.mpa (mean pixel attribute) calculates the average value of the attribute of all the non-null cells in the sampling area as:

with:

  • i: attribute
  • m: number of non-null attributes in the sampling area
  • wi: number of cells of attribute i
  • size: size of sampling area (in cells)

the way the manpage just says "as:" and then "with:" and moves on… iconic honestly, she said figure it out 🫠 (that's literally how it's written, we're keeping it exactly as-is)


πŸ’… NOTES πŸ’…

  • Do not use absolute path names for the config and output file/map parameters. like, don't. 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 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). two totally different vibes depending on your OS, slay πŸ’»
  • If the input raster map contains only NULL values then r.li.mpa considers to have 0 patches.
  • If area is 0 r.li.mpa returns -1; it is possible only if the raster is masked.
  • If you want to change these -1 values to NULL, run subsequently on the resulting map:
r.null setnull=-1 input=my_map

after index calculation. ⭐

ngl that last one is a whole two-step routine, don't skip the second step or your map is gonna have weird -1s in it 😭

πŸ”₯ EXAMPLES πŸ”₯

To calculate the mean pixel attribute 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.mpa 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.mpa input=forests conf=movwindow7 out=forests_mpa_mov7
r.univar forests_mpa_mov7

Forest map (North Carolina sample dataset) example:

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

bestie look at those workflows, she ATE and left no crumbs πŸ‘‘


πŸ‘‘ 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)

academic queen behavior fr fr πŸŽ“


πŸ’– 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.mpa source code (history)

Accessed: Saturday Jan 17 05:40:52 2026

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


and that's the whole page, babe πŸ’œ this manual is from GRASS GIS 8.4.2 and it's dated Saturday Jan 17 05:40:52 2026 (that's the footer energy right there), copyright Β© 2003-2025 GRASS Development Team β€” go forth and calculate those mean pixel attributes, you absolute icon πŸŒˆπŸ¦‹βœ¨

πŸ“¦ where this page comes from