r.mode(1grass)

πŸ’– r.mode β€” bestie's guide to finding the mode πŸ’–

okay so you're here because you picked up the GRASS User's Manual page for r.mode(1grass), and honestly? good choice. this one's lowkey a banger.


✨ NAME ✨

r.mode β€” finds the mode of values in a cover map within areas assigned the same category value in a user-specified base map. it's giving "most popular kid in every friend group" energy fr fr πŸ‘‘


🏷️ KEYWORDS 🏷️

raster, statistics, algebra


πŸŽ€ SYNOPSIS πŸŽ€

r.mode
r.mode --help
r.mode base=string cover=string output=string  [--overwrite]  [--help]
[--verbose]  [--quiet]  [--ui]

🚩 Flags 🚩

  • --overwrite β€” let your output files just bulldoze over existing files. no hesitation, no mercy, no "are you sure?" bestie it WILL overwrite 🌸
  • --help β€” prints the usage summary so you're not out here guessing
  • --verbose β€” verbose module output, aka the module tells you every little thing it's doing
  • --quiet β€” quiet module output, aka it shuts up and works
  • --ui β€” force launches the GUI dialog. main character mode, graphical edition ✨

πŸ“ Parameters πŸ“

  • base=string [required] β€” base map to be reclassified
  • cover=string [required] β€” coverage map
  • output=string [required] β€” output map
all three are required bestie, no skipping, no shortcuts πŸ’…

🌈 DESCRIPTION 🌈

so r.mode does the thing: it calculates the most frequently occurring value (i.e., the mode) of the data sitting in a cover raster map layer, for areas that all got assigned the same category value in the base raster map layer you specify. those modes get stored in a brand new output map layer. cute, right?

the output map is literally a reclass of the base map</> β€” that's the vibe.

the base parameter defines an existing raster map layer in your current mapset search path. for each group of cells that share the same category value in the base map, the mode of the values those same cells hold in the cover map gets computed. girl math but make it spatial πŸ“Š

the cover parameter defines an existing raster map layer containing the values used to compute the mode within each category of the base map.


⚠️ NOTES ⚠️

okay bestie, listen up, because the user should use the results of r.mode with care. this utility assigns a value to each cell that's based on global information β€” meaning info at spatial locations other than just the location of the cell itself. so the resultant map layer is only valid if the geographic region and mask settings are the same as they were at the time the result map was created. change them and it's over, no cap 😭

results are affected by the current region settings and mask. periodt.


πŸ”₯ EXAMPLE πŸ”₯

mode of K-factor (erosion) for Spearfish fields:

g.region raster=fields -p
r.mode base=fields cover=soils.Kfactor output=K.by.farm.mode
r.univar K.by.farm.mode

πŸ‘€ SEE ALSO πŸ‘€

g.region, r.category, r.clump, r.describe, r.mapcalc, r.mfilter, r.neighbors, r.reclass, r.stats, r.statistics, r.univar


πŸ‘‘ AUTHOR πŸ‘‘

Michael Shapiro, U.S.Army Construction Engineering Research Laboratory


πŸ¦‹ SOURCE CODE πŸ¦‹

Available at: r.mode source code (history)

Latest change: Thursday May 08 20:58:05 2025 in commit: 4144ba81fa125e1549fc52e1cf5feb4fa004be8b

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


okay that's the whole page babes, tysm for reading to the end 🫢 this was brought to you by GRASS 8.5.0, and the footer tea: Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual β€” so this page is literally r.mode(1grass) from the GRASS 8.5.0 manual. slay, bye πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from