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 reclassifiedcover=string[required] β coverage mapoutput=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
- 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