r.report(1grass)

🌸 r.report πŸ’… β€” GRASS User's Manual, but make it cute 🌸

okay bestie, so we're doing r.report(1grass) β€” that's the manual page name, iconic, we stan a raster statistics situation πŸ’–


✨ NAME ✨

r.report β€” Reports statistics for raster maps. that's it, that's the whole vibe πŸ¦‹


🏷️ KEYWORDS 🏷️

raster, statistics β€” literally the tag list, no notes πŸ’…


πŸ”₯ SYNOPSIS πŸ”₯

the way this thing gets called, fr fr:

r.report
r.report --help
r.report [-hfenaci] map=name[,name,...]  [units=string[,string,...]]
[output=name]   [null_value=string]   [page_length=integer]
[page_width=integer]   [nsteps=integer]   [sort=string]  format=name
[--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

πŸŽ€ Flags πŸŽ€

  • -h β€” Suppress page headers. no header moment, just the body 🫢
  • -f β€” Use formfeeds between pages. page breaks, but make it vintage ✨
  • -e β€” Scientific format. big brain numbers, 1.23e+05 core πŸ’€
  • -n β€” Do not report no data value. hide the NULLs bestie πŸ™ˆ
  • -a β€” Do not report cells where all maps have no data. if literally every map is empty there, we simply don't mention it πŸ’…
  • -c β€” Report for cats floating-point ranges (floating-point maps only). floating-point only, don't try it elsewhere, iykyk πŸ¦‹
  • -i β€” Read floating-point map as integer (use map’s quant rules). treats the float as an int using the map's own quant rules 🌸
  • --overwrite β€” Allow output files to overwrite existing files. yes queen, replace it πŸ‘‘
  • --help β€” Print usage summary. when u forgot literally everything 😭
  • --verbose β€” Verbose module output. tell me EVERYTHING πŸ—£οΈ
  • --quiet β€” Quiet module output. shhh 🀫
  • --ui β€” Force launching GUI dialog. for the main characters who need buttons πŸ–±οΈ

🌈 Parameters 🌈

  • map=name[,name,...] β€” [required] β€” Name of raster map(s) to report on. could be one, could be a whole squad of maps πŸ’–
  • units=string[,string,...] β€” Units to report.
    • Options: miles, meters, kilometers, acres, hectares, cells, percent
    • Default: cells,percent
    • miles: area in square miles
    • meters: area in square meters
    • kilometers: area in square kilometers
    • acres: area in acres
    • hectares: area in hectares
    • cells: number of cells
    • percent: percent cover
  • output=name β€” Name for output file to hold the report. If no output file given report is printed to standard output. no file? it just yells into stdout, periodt 🫢
  • null_value=string β€” String representing NULL value. Default: *
  • page_length=integer β€” Page length. Default: 0
  • page_width=integer β€” Page width. Default: 79
  • nsteps=integer β€” Number of floating-point subranges to collect stats from. Default: 255
  • sort=string β€” Sort output statistics by cell counts. Default: sorted by categories or intervals
    • Options: asc, desc
    • asc: Sort by cell counts in ascending order
    • desc: Sort by cell counts in descending order
  • format=name β€” [required] β€” Output format.
    • Options: plain, json
    • Default: plain
    • plain: Plain text output
    • json: JSON (JavaScript Object Notation)

πŸ“ DESCRIPTION πŸ“

so r.report lets u set up a whole lil lineup of report parameters and apply them to a raster map, and then it makes u a report πŸ’–. If the output parameter isn't given, that report just prints out to standard output. simple as that.

The report itself comes in two parts, bestie: a header section and the main body of the report. two icons, one document ✨

The header section identifies the raster map(s) (by map name and title), the project, the mapset, the report date, and the region of interest. And the area of interest gets described in two parts, okurrr: ur current geographic region is presented, and the mask is presented too (if any is used). yes, IF any 🫢

The main body of the report is made of from one to three tables which present the statistics for each category and the totals for each unit column 🌈. Quick reality check tho: the statistics is always computed in the current geographical region πŸ‘‘

When multiple (typically two) raster maps are specified, a cross-tabulation table for each combination of categories in the raster maps gets computed and formatted in a human-readable way (see example). multiple maps = combo grid, slay πŸ”₯


πŸ“Œ NOTES πŸ“Œ

okay important, and it's giving comparison energy: unlike r.stats, r.report lets u select the specific units of measure that the statistics get reported in πŸ’…. If u want computer-friendly data that's suitable for importing into a spreadsheet, use the r.stats module instead. In fact β€” and this is the fun part β€” r.report is literally running r.stats in the background and reformatting the results to be more human-friendly. it's a glow-up, no cap ✨

not me exposing the whole backend like that πŸ’€ r.stats is doing the work, r.report is doing the aesthetics πŸŽ€

✨ EXAMPLE ✨

okay bestie, let’s see this in action because examples are literally everything πŸ’…. first up: report sorted areas in square miles and acres for each category. no-data are not reported (peep the -n flag if you want them).

r.report -n map=geology_30m units=mi,a sort=desc
+-----------------------------------------------------------------------------+
|                         RASTER MAP CATEGORY REPORT                          |
|PROJECT: nc_spm_08_grass7                            Fri Dec  6 17:00:21 2013|
|-----------------------------------------------------------------------------|
|          north: 279073.97546639    east: 798143.31179672                    |
|REGION    south: 113673.97546639    west: 595143.31179672                    |
|          res:               200    res:              200                    |
|-----------------------------------------------------------------------------|
|MASK: none                                                                   |
|-----------------------------------------------------------------------------|
|MAP: South-West Wake county: geology derived from vector map (geology_30m in |
|-----------------------------------------------------------------------------|
|                 Category Information                  |    square|          |
|  #|description                                        |     miles|     acres|
|-----------------------------------------------------------------------------|
|217|CZfg . . . . . . . . . . . . . . . . . . . . . . . | 27.783911|17,781.703|
|270|CZig . . . . . . . . . . . . . . . . . . . . . . . | 26.162282|16,743.861|
|405|CZbg . . . . . . . . . . . . . . . . . . . . . . . |  9.698886|  6207.287|
|262|CZlg . . . . . . . . . . . . . . . . . . . . . . . |  7.629379|  4882.802|
|862|CZam . . . . . . . . . . . . . . . . . . . . . . . |  2.532830|  1621.011|
|910|CZbg . . . . . . . . . . . . . . . . . . . . . . . |  1.683405|  1077.379|
|583|CZve . . . . . . . . . . . . . . . . . . . . . . . |  0.972977|   622.706|
|921|Km . . . . . . . . . . . . . . . . . . . . . . . . |  0.463323|   296.526|
|766|CZg. . . . . . . . . . . . . . . . . . . . . . . . |  0.324326|   207.569|
|720|CZam . . . . . . . . . . . . . . . . . . . . . . . |  0.185329|   118.611|
|946|CZam . . . . . . . . . . . . . . . . . . . . . . . |  0.138997|    88.958|
|948|CZam . . . . . . . . . . . . . . . . . . . . . . . |  0.030888|    19.768|
|-----------------------------------------------------------------------------|
|TOTAL                                                  | 77.606534|49,668.182|
+-----------------------------------------------------------------------------+

now let’s report areas for each category of land use for each zipcode. this output only shows part of the table, don't come for me 😭.

r.report map=zipcodes@PERMANENT,landclass96@PERMANENT units=h,p
+-----------------------------------------------------------------------------+
|                         RASTER MAP CATEGORY REPORT                          |
|PROJECT: nc_spm_08_latest                            Tue Feb 11 10:10:46 2014|
|-----------------------------------------------------------------------------|
|          north: 228527.25    east: 644971                                   |
|REGION    south: 215018.25    west: 629980                                   |
|          res:        28.5    res:    28.5                                   |
|-----------------------------------------------------------------------------|
|MASK: none                                                                   |
|-----------------------------------------------------------------------------|
|MAPS: South West Wake: Zipcode areas derived from vector map (zipcodes@PERMAN|
|        South-West Wake county: Simplified landuse classes (landclass96@PERMA|
|-----------------------------------------------------------------------------|
|                   Category Information                    |          |   %  |
|    #|description                                          |  hectares| cover|
|-----------------------------------------------------------------------------|
|27511|CARY                                                 |  1053.813|  5.20|
|     |-----------------------------------------------------|----------|------|
|     |1|developed. . . . . . . . . . . . . . . . . . . . . |   197.214| 18.71|
|     |3|herbaceous . . . . . . . . . . . . . . . . . . . . |    25.017|  2.37|
|     |4|shrubland. . . . . . . . . . . . . . . . . . . . . |    58.563|  5.56|
|     |5|forest . . . . . . . . . . . . . . . . . . . . . . |   771.313| 73.19|
|     |6|water. . . . . . . . . . . . . . . . . . . . . . . |     1.625|  0.15|
|     |*|no data. . . . . . . . . . . . . . . . . . . . . . |     0.081|  0.01|
|-----------------------------------------------------------|----------|------|
|27513|CARY                                                 |   204.525|  1.01|
|     |-----------------------------------------------------|----------|------|
|     |1|developed. . . . . . . . . . . . . . . . . . . . . |    32.571| 15.93|
|     |3|herbaceous . . . . . . . . . . . . . . . . . . . . |     6.011|  2.94|
|     |4|shrubland. . . . . . . . . . . . . . . . . . . . . |    51.659| 25.26|
|     |5|forest . . . . . . . . . . . . . . . . . . . . . . |   114.284| 55.88|
|-----------------------------------------------------------|----------|------|
...
|-----------------------------------------------------------------------------|
|TOTAL                                                      |22,968.900|100.00|
+-----------------------------------------------------------------------------+

and because she’s versatile, the output from r.report can be output in JSON by passing the format=json option. literally iconic.

r.report -n -a map=towns,elevation units=miles,meters,kilometers,acres,hectares,cells,percent nsteps=2 format=json
{
    "location": "nc_spm_08_grass7",
    "created": "2024-07-24T14:59:09+0530",
    "region": {
        "north": 320000,
        "south": 10000,
        "east": 935000,
        "west": 120000,
        "ew_res": 500,
        "ns_res": 500
    },
    "mask": null,
    "maps": [
        {
            "name": "towns",
            "label": "South West Wake: Cities and towns derived from zipcodes",
            "type": "raster",
        },
        {
            "name": "zipcodes",
            "label": "South West Wake: Zipcode areas derived from vector map",
            "type": "raster",
        }
    ],
    "categories": [
        {
            "category": 1,
            "label": "CARY",
            "units": [
                {
                    "unit": "square miles",
                    "value": 10.231707201374819
                },
                {
                    "unit": "square meters",
                    "value": 26500000
                },
                {
                    "unit": "square kilometers",
                    "value": 26.5
                },
                {
                    "unit": "acres",
                    "value": 6548.2926088798722
                },
                {
                    "unit": "hectares",
                    "value": 2650
                },
                {
                    "unit": "cell counts",
                    "value": 106
                },
                {
                    "unit": "% cover",
                    "value": 13.086419753086419
                }
            ],
            "categories": [
                {
                    "category": 1,
                    "label": "from to",
                    "range": {
                        "from": 55.578792572021484,
                        "to": 105.9543285369873
                    },
                    "units": [
                        {
                            "unit": "square miles",
                            "value": 0.8687298567205034
                        },
                        {
                            "unit": "square meters",
                            "value": 2250000
                        },
                        {
                            "unit": "square kilometers",
                            "value": 2.25
                        },
                        {
                            "unit": "acres",
                            "value": 555.98710830112122
                        },
                        {
                            "unit": "hectares",
                            "value": 225
                        },
                        {
                            "unit": "cell counts",
                            "value": 9
                        },
                        {
                            "unit": "% cover",
                            "value": 8.4905660377358494
                        }
                    ]
                },
                {
                    "category": 2,
                    "label": "from to",
                    "range": {
                        "from": 105.9543285369873,
                        "to": 156.32986450195312
                    },
                    "units": [
                        {
                            "unit": "square miles",
                            "value": 9.3629773446543147
                        },
                        {
                            "unit": "square meters",
                            "value": 24250000
                        },
                        {
                            "unit": "square kilometers",
                            "value": 24.25
                        },
                        {
                            "unit": "acres",
                            "value": 5992.305500578751
                        },
                        {
                            "unit": "hectares",
                            "value": 2425
                        },
                        {
                            "unit": "cell counts",
                            "value": 97
                        },
                        {
                            "unit": "% cover",
                            "value": 91.509433962264154
                        }
                    ]
                }
            ]
        },
        {
            "category": 2,
            "label": "GARNER",
            "units": [
                {
                    "unit": "square miles",
                    "value": 5.5019557592298556
                },
                {
                    "unit": "square meters",
                    "value": 14250000

*okay bestie we're still in the JSON, don't scroll past it, this is the actual data 😀 β€” every number, every unit, every brace, copy-pasted with zero edits because that's the whole vibe πŸ’…*

}, { "unit": "square kilometers", "value": 14.25 }, { "unit": "acres", "value": 3521.2516859071011 }, { "unit": "hectares", "value": 1425 }, { "unit": "cell counts", "value": 57 }, { "unit": "% cover", "value": 7.0370370370370372 } ], "categories": [ { "category": 1, "label": "from to", "range": { "from": 55.578792572021484, "to": 105.9543285369873 }, "units": [ { "unit": "square miles", "value": 4.3436492836025176 }, { "unit": "square meters", "value": 11250000 }, { "unit": "square kilometers", "value": 11.25 }, { "unit": "acres", "value": 2779.9355415056061 }, { "unit": "hectares", "value": 1125 }, { "unit": "cell counts", "value": 45 }, { "unit": "% cover", "value": 78.94736842105263 } ] }, { "category": 2, "label": "from to", "range": { "from": 105.9543285369873, "to": 156.32986450195312 }, "units": [ { "unit": "square miles", "value": 1.158306475627338 }, { "unit": "square meters", "value": 3000000 }, { "unit": "square kilometers", "value": 3 }, { "unit": "acres", "value": 741.31614440149497 }, { "unit": "hectares", "value": 300 }, { "unit": "cell counts", "value": 12 }, { "unit": "% cover", "value": 21.05263157894737 } ] } ] }, { "category": 3, "label": "APEX", "units": [ { "unit": "square miles", "value": 0.9652553963561149 }, { "unit": "square meters", "value": 2500000 }, { "unit": "square kilometers", "value": 2.5 }, { "unit": "acres", "value": 617.76345366791247 }, { "unit": "hectares", "value": 250 }, { "unit": "cell counts", "value": 10 }, { "unit": "% cover", "value": 1.2345679012345678 } ], "categories": [ { "category": 1, "label": "from to", "range": { "from": 55.578792572021484, "to": 105.9543285369873 }, "units": [ { "unit": "square miles", "value": 0.096525539635611488 }, { "unit": "square meters", "value": 250000 }, { "unit": "square kilometers", "value": 0.25 }, { "unit": "acres", "value": 61.776345366791247 }, { "unit": "hectares", "value": 25 }, { "unit": "cell counts", "value": 1 }, { "unit": "% cover", "value": 10 } ] }, { "category": 2, "label": "from to", "range": { "from": 105.9543285369873, "to": 156.32986450195312 }, "units": [ { "unit": "square miles", "value": 0.8687298567205034 }, { "unit": "square meters", "value": 2250000 }, { "unit": "square kilometers", "value": 2.25 }, { "unit": "acres", "value": 555.98710830112122 }, { "unit": "hectares", "value": 225 }, { "unit": "cell counts", "value": 9 }, { "unit": "% cover", "value": 90 } ] } ] }, { "category": 4, "label": "RALEIGH-CITY", "units": [ { "unit": "square miles", "value": 6.0811089970435237 }, { "unit": "square meters", "value": 15750000 }, { "unit": "square kilometers", "value": 15.75 }, { "unit": "acres", "value": 3891.9097581078486 }, { "unit": "hectares", "value": 1575 }, { "unit": "cell counts", "value": 63 }, { "unit": "% cover", "value": 7.7777777777777777 } ], "categories": [ { "category": 1, "label": "from to", "range": { "from": 55.578792572021484, "to": 105.9543285369873 }, "units": [ { "unit": "square miles", "value": 5.3089046799586326 }, { "unit": "square meters", "value": 13750000 }, { "unit": "square kilometers", "value": 13.75 }, { "unit": "acres", "value": 3397.6989951735186 }, { "unit": "hectares", "value": 1375 }, { "unit": "cell counts", "value": 55 }, { "unit": "% cover", "value": 87.301587301587304 } ] }, { "category": 2, "label": "from to", "range": { "from": 105.9543285369873, "to": 156.32986450195312 }, "units": [ { "unit": "square miles", "value": 0.7722043170848919


---

<lavender>the way this report just keeps nesting like that 😭 eyes glazing over, but we stay <bold>strong</bold> and we do <bold>not</bold> skip a single one of these numbers, bestie</lavender> ✨

},
                               {
                                   "unit": "square meters",
                                   "value": 2000000
                               },
                               {
                                   "unit": "square kilometers",
                                   "value": 2
                               },
                               {
                                   "unit": "acres",
                                   "value": 494.21076293432998
                               },
                               {
                                   "unit": "hectares",
                                   "value": 200
                               },
                               {
                                   "unit": "cell counts",
                                   "value": 8
                               },
                               {
                                   "unit": "% cover",
                                   "value": 12.698412698412698
                               }
                           ]
                       }
                   ]
               },
               {
                   "category": 5,
                   "label": "RALEIGH-SOUTH",
                   "units": [
                       {
                           "unit": "square miles",
                           "value": 47.394039961085241
                       },
                       {
                           "unit": "square meters",
                           "value": 122750000
                       },
                       {
                           "unit": "square kilometers",
                           "value": 122.75
                       },
                       {
                           "unit": "acres",
                           "value": 30332.185575094503
                       },
                       {
                           "unit": "hectares",
                           "value": 12275
                       },
                       {
                           "unit": "cell counts",
                           "value": 491
                       },
                       {
                           "unit": "% cover",
                           "value": 60.617283950617285
                       }
                   ],
                   "categories": [
                       {
                           "category": 1,
                           "label": "from to",
                           "range": {
                               "from": 55.578792572021484,
                               "to": 105.9543285369873
                           },
                           "units": [
                               {
                                   "unit": "square miles",
                                   "value": 25.579268003437047
                               },
                               {
                                   "unit": "square meters",
                                   "value": 66250000
                               },
                               {
                                   "unit": "square kilometers",
                                   "value": 66.25
                               },
                               {
                                   "unit": "acres",
                                   "value": 16370.731522199681
                               },
                               {
                                   "unit": "hectares",
                                   "value": 6625
                               },
                               {
                                   "unit": "cell counts",
                                   "value": 265
                               },
                               {
                                   "unit": "% cover",
                                   "value": 53.971486761710793
                               }
                           ]
                       },
                       {
                           "category": 2,
                           "label": "from to",
                           "range": {
                               "from": 105.9543285369873,
                               "to": 156.32986450195312
                           },
                           "units": [
                               {
                                   "unit": "square miles",
                                   "value": 21.814771957648198
                               },
                               {
                                   "unit": "square meters",
                                   "value": 56500000
                               },
                               {
                                   "unit": "square kilometers",
                                   "value": 56.5
                               },
                               {
                                   "unit": "acres",
                                   "value": 13961.454052894822
                               },
                               {
                                   "unit": "hectares",
                                   "value": 5650
                               },
                               {
                                   "unit": "cell counts",
                                   "value": 226
                               },
                               {
                                   "unit": "% cover",
                                   "value": 46.028513238289207
                               }
                           ]
                       }
                   ]
               },
               {
                   "category": 6,
                   "label": "RALEIGH-WEST",
                   "units": [
                       {
                           "unit": "square miles",
                           "value": 8.0116197897557537
                       },
                       {
                           "unit": "square meters",
                           "value": 20750000
                       },
                       {
                           "unit": "square kilometers",
                           "value": 20.75
                       },
                       {
                           "unit": "acres",
                           "value": 5127.4366654436735
                       },
                       {
                           "unit": "hectares",
                           "value": 2075
                       },
                       {
                           "unit": "cell counts",
                           "value": 83
                       },
                       {
                           "unit": "% cover",
                           "value": 10.246913580246913
                       }
                   ],
                   "categories": [
                       {
                           "category": 1,
                           "label": "from to",
                           "range": {
                               "from": 55.578792572021484,
                               "to": 105.9543285369873
                           },
                           "units": [
                               {
                                   "unit": "square miles",
                                   "value": 0.096525539635611488
                               },
                               {
                                   "unit": "square meters",
                                   "value": 250000
                               },
                               {
                                   "unit": "square kilometers",
                                   "value": 0.25
                               },
                               {
                                   "unit": "acres",
                                   "value": 61.776345366791247
                               },
                               {
                                   "unit": "hectares",
                                   "value": 25
                               },
                               {
                                   "unit": "cell counts",
                                   "value": 1
                               },
                               {
                                   "unit": "% cover",
                                   "value": 1.2048192771084338
                               }
                           ]
                       },
                       {
                           "category": 2,
                           "label": "from to",
                           "range": {
                               "from": 105.9543285369873,
                               "to": 156.32986450195312
                           },
                           "units": [
                               {
                                   "unit": "square miles",
                                   "value": 7.9150942501201422
                               },
                               {
                                   "unit": "square meters",
                                   "value": 20500000
                               },
                               {
                                   "unit": "square kilometers",
                                   "value": 20.5
                               },
                               {
                                   "unit": "acres",
                                   "value": 5065.6603200768823
                               },
                               {
                                   "unit": "hectares",
                                   "value": 2050
                               },
                               {
                                   "unit": "cell counts",
                                   "value": 82
                               },
                               {
                                   "unit": "% cover",
                                   "value": 98.795180722891573
                               }
                           ]
                       }
                   ]
               }
           ],
           "totals": [
               {
                   "unit": "square miles",
                   "value": 78.185687104845314
               },
               {
                   "unit": "square meters",
                   "value": 202500000
               },
               {
                   "unit": "square kilometers",
                   "value": 202.5
               },
               {
                   "unit": "acres",
                   "value": 50038.839747100916
               },
               {
                   "unit": "hectares",
                   "value": 20250
               },
               {
                   "unit": "cell counts",
                   "value": 810
               },
               {
                   "unit": "% cover",
                   "value": 100
               }
           ]
       }

okay and that's the whole JSON payload bestie 🫢 "totals" at the bottom is the vibe check that everything adds up β€” "cell counts" totals 810 and "% cover" totals 100, which is giving the math is mathing ✨. And notice every single category carries "square miles", "square meters", "square kilometers", "acres", "hectares", "cell counts" and "% cover" β€” no cap, it's the full unit serving platter every time πŸ’….

Also living for the nested "categories" situation inside "RALEIGH-SOUTH" and "RALEIGH-WEST" β€” they each break down into their own "category": 1 and "category": 2 with "label": "from to" and a "range" of "from" / "to" values πŸ¦‹. Ngl "from to" as a label is sending me a little πŸ’€ but she's doing her job and we respect her.


πŸ‘€ SEE ALSO πŸ‘‘

besties you should also be checking out:

  • r.stats
  • g.region
  • r.coin
  • r.describe
  • r.info
  • r.univar

all fr fr iconic, go read them πŸ’–


πŸŽ€ AUTHORS πŸŽ€

  • Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
  • Sort option by Martin Landa, Czech Technical University in Prague, 2013

slay to both of them, honestly πŸ™Œ


🌈 SOURCE CODE 🌈

Available at: r.report source code (history)

Latest change: Sunday Nov 09 19:22:25 2025 in commit: 7335bd572fec91187fef5f9a6c2e984caf4650fc

Indexes to go get lost in for hours:

  • Main index
  • Raster index
  • Topics index
  • Keywords index
  • Graphical index
  • Full index

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual


okay so that's the whole thing πŸ₯ΉπŸ’œ you just read r.report(1grass) top to bottom, front to back β€” every flag, every unit, every last bracket. so proud of you. This one's from GRASS 8.5.0, last touched Sunday Nov 09 19:22:25 2025 (commit 7335bd572fec91187fef5f9a6c2e984caf4650fc, real ones know), and it's copyrighted 2003-2026 by the GRASS Development Team. Now go make some maps, my little main character πŸŒΈπŸ¦‹βœ¨πŸ’…

πŸ“¦ where this page comes from