[GRASS-SVN] r58731 - grass/trunk/scripts/v.rast.stats

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 16 00:38:05 PST 2014


Author: lucadelu
Date: 2014-01-16 00:38:04 -0800 (Thu, 16 Jan 2014)
New Revision: 58731

Modified:
   grass/trunk/scripts/v.rast.stats/v.rast.stats.py
Log:
fix problem with abbreviate option

Modified: grass/trunk/scripts/v.rast.stats/v.rast.stats.py
===================================================================
--- grass/trunk/scripts/v.rast.stats/v.rast.stats.py	2014-01-16 01:36:32 UTC (rev 58730)
+++ grass/trunk/scripts/v.rast.stats/v.rast.stats.py	2014-01-16 08:38:04 UTC (rev 58731)
@@ -54,8 +54,8 @@
 #% description: The methods to use
 #% required: no
 #% multiple: yes
-#% options: number,minimum,maximum,range,mean,stddev,variance,coeff_var,sum
-#% answer: number,minimum,maximum,range,mean,stddev,variance,coeff_var,sum
+#% options: number,minimum,maximum,range,average,stddev,variance,coeff_var,sum
+#% answer: number,minimum,maximum,range,average,stddev,variance,coeff_var,sum
 #%end
 #%option
 #% key: percentile
@@ -176,7 +176,6 @@
     if dbfdriver:
         colprefix = colprefix[:6]
         variables_dbf = {}
-        
 
     # do extended stats?
     # by default perccol variable is used only for "variables" variable
@@ -191,9 +190,19 @@
     else:
         extracols = []
 
+    # dictionary with name of methods and position in "r.univar -gt"  output
+    variables = {'number': 2, 'minimum': 4, 'maximum': 5, 'range': 6,
+                 'average': 7, 'stddev': 9, 'variance': 10, 'coeff_var': 11,
+                 'sum': 12, 'first_quartile': 14, 'median': 15,
+                 'third_quartile': 16, perccol: 17}
     addcols = []
     colnames = []
     for i in basecols + extracols:
+        # this check the complete name of out input that should be truncated
+        for k in variables.keys():
+            if i in k:
+                i = k
+                break
         # check if column already present
         currcolumn = ("%s_%s" % (colprefix, i))
         if dbfdriver:
@@ -237,12 +246,7 @@
                            zones=rastertmp, percentile=percentile, sep=';')
 
     first_line = 1
-    
-    # dictionary with name of methods and position in "r.univar -gt"  output
-    variables = {'number': 2, 'minimum': 4, 'maximum': 5, 'range': 6,
-                 'mean': 7, 'stddev': 9, 'variance': 10, 'coeff_var': 11,
-                 'sum': 12, 'first_quartile': 14, 'median': 15,
-                 'third_quartile': 16, perccol: 17}
+
     if not dbfdriver:
         f.write("BEGIN TRANSACTION\n")
     for line in p.stdout:



More information about the grass-commit mailing list