grass icon indicating copy to clipboard operation
grass copied to clipboard

[Feat] r.report should have specified units parameter by default

Open petrasovaa opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe. When you simply run e.g. r.report zipcodes you get category and label, but no other info:

+-----------------------------------------------------------------------------+
|                         RASTER MAP CATEGORY REPORT                          |
|LOCATION: nc_spm_08_grass7                           Mon Nov  2 13:50:00 2020|
|-----------------------------------------------------------------------------|
|          north:   228513    east:   645012                                  |
|REGION    south: 214975.5    west: 629992.5                                  |
|          res:       28.5    res:      28.5                                  |
|-----------------------------------------------------------------------------|
|MASK: none                                                                   |
|-----------------------------------------------------------------------------|
|MAP: South West Wake: Zipcode areas derived from vector map (zipcodes in PERM|
|-----------------------------------------------------------------------------|
|                            Category Information                             |
|    #|description                                                            |
|-----------------------------------------------------------------------------|
|27511|CARY                                                                   |
|27513|CARY                                                                   |
|27518|CARY                                                                   |
|27529|GARNER                                                                 |
|27539|APEX                                                                   |
|27601|RALEIGH                                                                |
|27603|RALEIGH                                                                |
|27604|RALEIGH                                                                |
|27605|RALEIGH                                                                |
|27606|RALEIGH                                                                |
|27607|RALEIGH                                                                |
|27608|RALEIGH                                                                |
|27610|RALEIGH                                                                |
|    *|no data                                                                |
+-----------------------------------------------------------------------------+

Describe the solution you'd like I would prefer to have by default units=c or units=c,p, so then the result of the same command would be:

+-----------------------------------------------------------------------------+
|                         RASTER MAP CATEGORY REPORT                          |
|LOCATION: nc_spm_08_grass7                           Mon Nov  2 13:53:31 2020|
|-----------------------------------------------------------------------------|
|          north:   228513    east:   645012                                  |
|REGION    south: 214975.5    west: 629992.5                                  |
|          res:       28.5    res:      28.5                                  |
|-----------------------------------------------------------------------------|
|MASK: none                                                                   |
|-----------------------------------------------------------------------------|
|MAP: South West Wake: Zipcode areas derived from vector map (zipcodes in PERM|
|-----------------------------------------------------------------------------|
|                     Category Information                      |  cell|   %  |
|    #|description                                              | count| cover|
|-----------------------------------------------------------------------------|
|27511|CARY . . . . . . . . . . . . . . . . . . . . . . . . . . | 13077|  5.22|
|27513|CARY . . . . . . . . . . . . . . . . . . . . . . . . . . |  2572|  1.03|
|27518|CARY . . . . . . . . . . . . . . . . . . . . . . . . . . | 16608|  6.63|
|27529|GARNER . . . . . . . . . . . . . . . . . . . . . . . . . | 17479|  6.98|
|27539|APEX . . . . . . . . . . . . . . . . . . . . . . . . . . |  3119|  1.25|
|27601|RALEIGH. . . . . . . . . . . . . . . . . . . . . . . . . |  5604|  2.24|
|27603|RALEIGH. . . . . . . . . . . . . . . . . . . . . . . . . | 52836| 21.11|
|27604|RALEIGH. . . . . . . . . . . . . . . . . . . . . . . . . |  5869|  2.34|
|27605|RALEIGH. . . . . . . . . . . . . . . . . . . . . . . . . |  2918|  1.17|
|27606|RALEIGH. . . . . . . . . . . . . . . . . . . . . . . . . | 81533| 32.57|
|27607|RALEIGH. . . . . . . . . . . . . . . . . . . . . . . . . | 25870| 10.33|
|27608|RALEIGH. . . . . . . . . . . . . . . . . . . . . . . . . |  5488|  2.19|
|27610|RALEIGH. . . . . . . . . . . . . . . . . . . . . . . . . | 16825|  6.72|
|    *|no data. . . . . . . . . . . . . . . . . . . . . . . . . |   527|  0.21|
|-----------------------------------------------------------------------------|
|TOTAL                                                          |250325|100.00|
+-----------------------------------------------------------------------------+

Describe alternatives you've considered Obviously adding units=c,p to the command does the job.

Additional context I hit this issue when I wanted to get an overview of a large raster and since I didn't remember I need to add units parameter I waited for a minute and then got an unhelpful output and I needed to rerun it again with units parameter.

petrasovaa avatar Nov 02 '20 18:11 petrasovaa

Also in my view a default should be set.

Quick status overview:

units default is "meters":

  • https://grass.osgeo.org/grass79/manuals/d.geodesic.html
  • https://grass.osgeo.org/grass79/manuals/r.buffer.html
  • https://grass.osgeo.org/grass79/manuals/r.buffer.lowmem.html

Missing a default value:

  • https://grass.osgeo.org/grass79/manuals/m.measure.html
  • https://grass.osgeo.org/grass79/manuals/r.report.html
  • https://grass.osgeo.org/grass79/manuals/r.profile.html
  • https://grass.osgeo.org/grass79/manuals/r.surf.area.html
  • https://grass.osgeo.org/grass79/manuals/v.report.html
  • https://grass.osgeo.org/grass79/manuals/v.to.db.html

In addition, the choices of units to report differ...

neteler avatar Nov 02 '20 21:11 neteler

These all need to be assessed individually, I don't think they suffer from the exact same issue as r.report, e.g. v.report always prints out the area even if no unit is specified, but the manual seems unclear what unit it actually is. So separate issue would be better for each.

petrasovaa avatar Nov 03 '20 03:11 petrasovaa