[GRASS-SVN] r63205 - grass/trunk/scripts/i.colors.enhance
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Nov 27 07:55:49 PST 2014
Author: mmetz
Date: 2014-11-27 07:55:49 -0800 (Thu, 27 Nov 2014)
New Revision: 63205
Modified:
grass/trunk/scripts/i.colors.enhance/i.colors.enhance.py
Log:
i.colors.enhance: optimize
Modified: grass/trunk/scripts/i.colors.enhance/i.colors.enhance.py
===================================================================
--- grass/trunk/scripts/i.colors.enhance/i.colors.enhance.py 2014-11-27 15:27:32 UTC (rev 63204)
+++ grass/trunk/scripts/i.colors.enhance/i.colors.enhance.py 2014-11-27 15:55:49 UTC (rev 63205)
@@ -84,14 +84,14 @@
val1 = percentiles[0]
val2 = percentiles[1]
values = '%s,%s' % (val1, val2)
- s = grass.read_command('r.univar', flags = 'ge',
- map = map, percentile = values)
- kv = grass.parse_key_val(s)
- # cleanse to match what the key name will become
- val_str1 = ('percentile_%.15g' % float(val1)).replace('.','_')
- val_str2 = ('percentile_%.15g' % float(val2)).replace('.','_')
- return (float(kv[val_str1]), float(kv[val_str2]))
+ s = grass.read_command('r.quantile', input = map,
+ percentiles = values, quiet = True)
+
+ val_str1 = s.splitlines()[0].split(':')[2]
+ val_str2 = s.splitlines()[1].split(':')[2]
+ return (float(val_str1), float(val_str2))
+
# wrapper to handle multiprocesses communications back to the parent
def get_percentile_mp(map, percentiles, conn):
# Process() doesn't like storing connection parts in
More information about the grass-commit
mailing list