Browse Source

r.report: add default units, change to full unit names (#1666)

* r.report: add default, change to full unit names

* change unit names in GUI
Anna Petrasova 3 years ago
parent
commit
46f8dd3d49
2 changed files with 9 additions and 6 deletions
  1. 5 1
      gui/wxpython/lmgr/layertree.py
  2. 4 5
      raster/r.report/parse.c

+ 5 - 1
gui/wxpython/lmgr/layertree.py

@@ -1128,7 +1128,11 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
 
         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):

+ 4 - 5
raster/r.report/parse.c

@@ -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"),
@@ -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);
@@ -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;