[GRASS-SVN] r52305 - grass/branches/develbranch_6/lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 4 14:00:44 PDT 2012


Author: hamish
Date: 2012-07-04 14:00:44 -0700 (Wed, 04 Jul 2012)
New Revision: 52305

Modified:
   grass/branches/develbranch_6/lib/python/raster.py
Log:
fix mapcalc_start() to work with grass6's r.mapcalc

Modified: grass/branches/develbranch_6/lib/python/raster.py
===================================================================
--- grass/branches/develbranch_6/lib/python/raster.py	2012-07-04 14:10:51 UTC (rev 52304)
+++ grass/branches/develbranch_6/lib/python/raster.py	2012-07-04 21:00:44 UTC (rev 52305)
@@ -133,7 +133,17 @@
     t = string.Template(exp)
     e = t.substitute(**kwargs)
 
-    return start_command('r.mapcalc', expression = e,
-                        quiet = quiet,
-                        verbose = verbose,
-                        overwrite = overwrite)
+    env = os.environ.copy()
+    if quiet:
+        env['GRASS_VERBOSE'] = '0'
+    if verbose:
+        env['GRASS_VERBOSE'] = '3'
+    if overwrite:
+        env['GRASS_OVERWRITE'] = '1'
+
+    stdin = e
+    p = feed_command('r.mapcalc', env = env, **kwargs)
+    p.stdin.write(stdin)
+    p.stdin.close()
+
+    return p



More information about the grass-commit mailing list