Skip to content

Commit

Permalink
r.report: add default units, change to full unit names (#1666)
Browse files Browse the repository at this point in the history
* r.report: add default, change to full unit names

* change unit names in GUI
  • Loading branch information
petrasovaa authored and neteler committed Jun 28, 2021
1 parent 80b616d commit 46f8dd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 5 additions & 1 deletion gui/wxpython/lmgr/layertree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,11 @@ def OnReportStats(self, event):

if rasters:
self._giface.RunCmd(
["r.report", "map=%s" % ",".join(rasters), "units=h,c,p"]
[
"r.report",
"map=%s" % ",".join(rasters),
"units=hectares,cells,percent",
]
)

def OnStartEditing(self, event):
Expand Down
9 changes: 4 additions & 5 deletions raster/r.report/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int parse_command_line(int argc, char *argv[])
parms.units->description = _("Units to report");
desc = NULL;
G_asprintf(&desc,
"mi;%s;me;%s;k;%s;a;%s;h;%s;c;%s;p;%s",
"miles;%s;meters;%s;kilometers;%s;acres;%s;hectares;%s;cells;%s;percent;%s",
_("area in square miles"),
_("area in square meters"),
_("area in square kilometers"),
Expand All @@ -54,7 +54,8 @@ int parse_command_line(int argc, char *argv[])
_("number of cells"),
_("percent cover"));
parms.units->descriptions = desc;
parms.units->options = "mi,me,k,a,h,c,p";
parms.units->options = "miles,meters,kilometers,acres,hectares,cells,percent";
parms.units->answer = "cells,percent";
parms.units->guisection = _("Statistics");

parms.outfile = G_define_standard_option(G_OPT_F_OUTPUT);
Expand Down Expand Up @@ -239,9 +240,7 @@ int parse_units(char *s)
x = ACRES;
else if (match(s, "hectares", 1))
x = HECTARES;
else if (match(s, "cell_counts", 1))
x = CELL_COUNTS;
else if (match(s, "counts", 1))
else if (match(s, "cells", 1))
x = CELL_COUNTS;
else if (match(s, "percent_cover", 1))
x = PERCENT_COVER;
Expand Down

0 comments on commit 46f8dd3

Please sign in to comment.