r.mode(1)
π¦ r.mode(1) β GRASS GIS User's Manual π¦
okay bestie, gather round, because r.mode is literally the friend who takes a whole crowd's vibe and picks the most popular one π
this is page r.mode(1) from the GRASS GIS User's Manual and it's lowkey iconic.
β¨ 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. fr fr that's the whole personality π
π·οΈ 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β Allow output files to overwrite existing files (yes queen, permission to replace, use wisely π)--helpβ Print usage summary--verboseβ Verbose module output--quietβ Quiet module output--uiβ Force launching GUI dialog
πΈ Parameters πΈ
base=string[required] β Base map to be reclassifiedcover=string[required] β Coverage mapoutput=string[required] β Output map
π DESCRIPTION π
so what does it DO. r.mode calculates the most frequently occurring value (i. e., mode) of data contained in a cover raster map layer for areas assigned the same category value in the user-specified base raster map layer. All those modes get stored in the new output map layer. it's giving "everyone pick your fave, we're tallying" β¨
The output map is actually a reclass of the base map. not me making a whole new map that's secretly the old map in a costume π
The base parameter defines an existing raster map layer in the user's current mapset search path. For each group of cells assigned the same category value in the base map, the mode of the values assigned these cells in the cover map will be computed. so like, every little clique in the base map gets its own most-popular cover value π
The cover parameter defines an existing raster map layer containing the values to be used to compute the mode within each category of the base map. that's the data getting voted on bestie π³οΈ
β οΈ NOTES β οΈ
The user should use the results of r.mode with care. Since this utility assigns a value to each cell which is based on global information (i.e., information at spatial locations other than just the location of the cell itself), the resultant map layer is only valid if the geographic region and mask settings are the same as they were at the time that the result map was created. π¨
ngl that's the big one β this map remembers the era it was born in. change your region or your mask and it's no longer telling the truth, periodt.
Results are affected by the current region settings and mask. no cap. π
π 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
look at her go π set the region, run the mode, then check your work. chef's kiss π§
π SEE ALSO π
g.region, r.category, r.clump, r.describe, r.mapcalc, r.mfilter, r.neighbors, r.reclass, r.stats, r.statistics, r.univar
the whole squad, honestly π«Ά
π AUTHOR π
Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
π» SOURCE CODE π»
Available at: r.mode source code (history)
Accessed: Saturday Jan 17 05:40:50 2026
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
and that's the tea, bestie π β this page is from GRASS GIS 8.4.2, the reference manual date stamped Saturday Jan 17 05:40:50 2026, so go forth and find your mode πβ¨
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· 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