r.quantile(1)

πŸ’– r.quantile(1) β€” the GRASS GIS User's Manual, but make it a group chat πŸ’–

okay bestie, welcome to r.quantile, straight out of the GRASS GIS User's Manual. this is the page where we learn to count in slices. it's giving statistics era and honestly? slay. 🌈


✨ NAME ✨

r.quantile β€” compute quantiles using two passes. that's it, that's the whole vibe. two passes, no cap. πŸ’…


πŸŽ€ KEYWORDS πŸŽ€

raster, algebra, statistics, percentile, quantile β€” iykyk, it's the whole tag wall πŸ¦‹


🌸 SYNOPSIS 🌸

okay so here's how you actually call her:

r.quantile
r.quantile --help
r.quantile [-r] input=name  [quantiles=integer]
[percentiles=float[,float,...]]   [bins=integer]   [file=name]
[--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

🫢 Flags:

  • -r β€” generate recode rules based on quantile-defined intervals. yes queen, output that r.recode-ready drip. πŸ”₯
  • --overwrite β€” allow output files to overwrite existing files. it will absolutely clobber what's there, so know that before you commit. πŸ’€
  • --help β€” print usage summary
  • --verbose β€” verbose module output. she talks a lot. we love her for it. ✨
  • --quiet β€” quiet module output
  • --ui β€” force launching GUI dialog

🧚 Parameters:

  • input=name β€” required, bestie. name of input raster map. can't run the show without the main character. πŸ‘‘
  • quantiles=integer β€” number of quantiles. default: 4. (quartiles, if you're feeling fancy πŸ“)
  • percentiles=float[,float,...] β€” list of percentiles. comma-separated, as many as your heart desires πŸ’œ
  • bins=integer β€” number of bins to use. default: 1000000. yes, one million. she's thorough. 😭
  • file=name β€” name for output file. if omitted or -, output goes to stdout. (the - is the classic "just print it at me" move πŸŽ€)

πŸ’« DESCRIPTION πŸ’«

r.quantile computes quantiles in a manner suitable for use with large amounts of data. and the way she does it? two passes. that's the whole trick, and it's iconic.


⭐ NOTES ⭐

quantiles are calculated following algorithm 7 from Hyndman and Fan (1996), which is also the default in R and numpy. so if your numbers don't match R, lowkey check yourself before you wreck yourself. no cap. πŸ¦‹


🌈 EXAMPLE 🌈

calculation of elevation quantiles (printed to standard-out):

g.region raster=elevation -p
r.quantile input=elevation percentiles=0.1,1,10,25,50,75,90,99,99.9

the output of r.quantile can be used for quantile classification:

g.region raster=elevation -p
r.quantile elevation quantiles=5 -r --quiet | r.recode elevation \
           out=elev_quant5 rules=-

see that pipe? that's the -r output feeding straight into r.recode with rules=-. chef's kiss. pipeline main character energy. πŸ’…


πŸ’– REFERENCES πŸ’–

  • Hyndman and Fan (1996) Sample Quantiles in Statistical Packages, American Statistician. American Statistical Association. 50 (4): 361-365. DOI: 10.2307/2684934
  • Engineering Statistics Handbook: Percentile, NIST

πŸ‘‘ SEE ALSO πŸ‘‘

r.mode, r.quant, r.recode, r.series, r.stats, r.stats.quantile, r.stats.zonal, r.statistics, r.univar, v.rast.stats

(the whole friend group, fr fr 🫢)


πŸŽ€ AUTHORS πŸŽ€

  • Glynn Clements
  • Markus Metz

πŸ¦‹ SOURCE CODE πŸ¦‹

Available at: r.quantile source code (history)

Accessed: Saturday Jan 17 05:40:56 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


ok that's the whole page bestie, go forth and slice your rasters πŸ’–

and that's a wrap on GRASS 8.4.2 β€” r.quantile(1), signing off. mwah. πŸ’‹βœ¨

πŸ“¦ where this page comes from