r.stats.quantile(1grass)

πŸ’– r.stats.quantile πŸ’–

okay bestie, welcome to r.stats.quantile(1grass) β€” the tool that does quantile math on your rasters and honestly? it ate. ✨

🌸 NAME 🌸

r.stats.quantile β€” compute category quantiles using two passes. yes, two. it's giving thorough. πŸ’…

πŸŽ€ KEYWORDS πŸŽ€

raster, statistics, zonal statistics, percentile, quantile

πŸ¦‹ SYNOPSIS πŸ¦‹

r.stats.quantile
r.stats.quantile --help
r.stats.quantile [-rpt] base=name cover=name  [quantiles=integer]
[percentiles=float[,float,...]]   [bins=integer]
[output=name[,name,...]]   [file=name]   [separator=character]
format=name  [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

✨ Flags ✨

  • -r β€” create a reclass map where the statistics show up as category labels. labels, bestie, we love a labeled moment 🏷️
  • -p β€” don't make any output maps, just print the statistics. lowkey the chill option 🫢
  • -t β€” print statistics in table format. deprecated, babes. this flag is deprecated and will be removed in a future release. use format=csv instead. periodt, the table flag is on its way out πŸ’€
  • --overwrite β€” allow output files to overwrite existing files. be careful, it's giving no-takebacks energy πŸ™ˆ
  • --help β€” print usage summary
  • --verbose β€” verbose module output
  • --quiet β€” quiet module output 🀫
  • --ui β€” force launching GUI dialog

πŸ’œ Parameters πŸ’œ

  • base=name [required] β€” name of base raster map
  • cover=name [required] β€” name of cover raster map
  • quantiles=integer β€” number of quantiles
  • percentiles=float[,float,...] β€” list of percentiles. Default: 50
  • bins=integer β€” number of bins to use. Default: 1000
  • output=name[,name,...] β€” resultant raster map(s)
  • file=name β€” name for output file (if omitted or "-" output to stdout)
  • separator=character β€” field separator. special characters: pipe, comma, space, tab, newline
  • format=name [required] β€” output format. Options: plain, csv, json. Default: plain
    • plain: human readable text output
    • csv: CSV (Comma Separated Values)
    • json: JSON (JavaScript Object Notation)

🌈 DESCRIPTION 🌈

so r.stats.quantile is the tool that analyses exploratory statistics of a floating-point "cover layer" based on how it intersects with objects in a "base layer". it hands you quantile calculations β€” you know, the ones selected as "zonal statistics". main character energy fr fr πŸ‘‘


⭐ NOTES ⭐

r.stats.quantile is intended as a partial replacement for r.statistics, and the big glow-up is that it supports floating-point cover maps. it provides quantile calculations β€” which are straight-up absent from r.stats.zonal. so if you needed quantiles and zonal wasn't giving, this is your girl. πŸ’…

quantiles are calculated following algorithm 7 from Hyndman and Fan (1996), which is also the default in R and numpy. iykyk, algorithm 7 is iconic. ✨


🧚 EXAMPLE 🧚

in this example, the raster polygon map zipcodes in the North Carolina sample dataset is used to calculate quantile raster statistics using the elevation raster map:

g.region raster=zipcodes -p
# print quantiles
r.stats.quantile base=zipcodes cover=elevation quantiles=3 -p
27511:0:33.333333:134.717392
27511:1:66.666667:143.985723
27513:0:33.333333:140.669993
27513:1:66.666667:146.279449
27518:0:33.333333:115.140101
27518:1:66.666667:129.893723
[...]
# write out percentile raster maps
r.stats.quantile base=zipcodes cover=elevation percentiles=25,50,75 \
  output=zipcodes_elev_q25,zipcodes_elev_q50,zipcodes_elev_q75

look at those numbers go 😭 so satisfying.


πŸ“š 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.quantile, r.stats.zonal, r.statistics


🫢 AUTHORS 🫢

Glynn Clements Markus Metz


πŸ’» SOURCE CODE πŸ’»

available at: r.stats.quantile source code (history)

latest change: Saturday Oct 11 04:38:40 2025 in commit: 3dd71f5fab83b72a2db2da959fe075c5b3b52200

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


okay that's the whole page, bestie, you're officially quantile-pilled 🌸

and before you go β€” the manual is GRASS 8.5.0, and it's Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual. mwah, go compute some quantiles πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from