[GRASS-SVN] r57623 - grass/trunk/lib/python/pygrass/modules/grid

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 9 11:17:58 PDT 2013


Author: zarch
Date: 2013-09-09 11:17:58 -0700 (Mon, 09 Sep 2013)
New Revision: 57623

Modified:
   grass/trunk/lib/python/pygrass/modules/grid/grid.py
Log:
Fix trac #2067, avoid to instantiate the Module('g.region') when import the grid module

Modified: grass/trunk/lib/python/pygrass/modules/grid/grid.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/grid/grid.py	2013-09-08 22:27:44 UTC (rev 57622)
+++ grass/trunk/lib/python/pygrass/modules/grid/grid.py	2013-09-09 18:17:58 UTC (rev 57623)
@@ -20,9 +20,6 @@
 from patch import patch_map
 
 
-_GREG = Module('g.region')
-
-
 def select(parms, ptype):
     """Select only a  certain type of parameters. ::
 
@@ -141,13 +138,14 @@
             inputs[key] = mapnames[key]
         cmd['inputs'] = inputs.items()
         # set the region to the tile
-        _GREG(env_=env, rast=key)
+        sub.Popen(['g,region', 'rast=%s' % key], env=env).wait()
     else:
         #reg = Region() nsres=reg.nsres, ewres=reg.ewres,
         # set the computational region
-        _GREG(env_=env, **bbox)
+        lcmd = ['g.region', ]
+        lcmd.extend(["%s=%s" % (k, v) for k, v in bbox.iteritems()])
+        sub.Popen(lcmd, env=env).wait()
     # run the grass command
-    #import ipdb; ipdb.set_trace()
     sub.Popen(get_cmd(cmd), env=env).wait()
 
 



More information about the grass-commit mailing list