[GRASS-SVN] r33677 - grass/trunk/scripts/r.blend

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 5 04:47:59 EDT 2008


Author: glynn
Date: 2008-10-05 04:47:59 -0400 (Sun, 05 Oct 2008)
New Revision: 33677

Modified:
   grass/trunk/scripts/r.blend/r.blend.py
Log:
Optimisation: use one r.mapcalc pass instead of three


Modified: grass/trunk/scripts/r.blend/r.blend.py
===================================================================
--- grass/trunk/scripts/r.blend/r.blend.py	2008-10-05 08:46:44 UTC (rev 33676)
+++ grass/trunk/scripts/r.blend/r.blend.py	2008-10-05 08:47:59 UTC (rev 33677)
@@ -81,9 +81,14 @@
 			    first = first, second = second,
 			    frac1 = frac1, frac2 = frac2)
     template = string.Template(s)
+    cmd = []
     for ch in ['r','g','b']:
 	map = "%s.%s" % (output, ch)
-	grass.run_command('r.mapcalc', expr = template.substitute(ch = ch))
+	cmd.append(template.substitute(ch = ch))
+    grass.run_command('r.mapcalc', expression = ';'.join(cmd))
+
+    for ch in ['r','g','b']:
+	map = "%s.%s" % (output, ch)
 	grass.run_command('r.colors', map = map, color = 'grey255')
 	grass.run_command('r.support', map = map,
 			  title = "Color blend of %s and %s" % (first, second), history="")



More information about the grass-commit mailing list