[GRASS-SVN] r63206 - grass/branches/releasebranch_7_0/scripts/i.colors.enhance
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Nov 27 08:14:30 PST 2014
Author: neteler
Date: 2014-11-27 08:14:30 -0800 (Thu, 27 Nov 2014)
New Revision: 63206
Modified:
grass/branches/releasebranch_7_0/scripts/i.colors.enhance/i.colors.enhance.py
Log:
i.colors.enhance: optimize speed (trunk, r63205)
Modified: grass/branches/releasebranch_7_0/scripts/i.colors.enhance/i.colors.enhance.py
===================================================================
--- grass/branches/releasebranch_7_0/scripts/i.colors.enhance/i.colors.enhance.py 2014-11-27 15:55:49 UTC (rev 63205)
+++ grass/branches/releasebranch_7_0/scripts/i.colors.enhance/i.colors.enhance.py 2014-11-27 16:14:30 UTC (rev 63206)
@@ -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