[GRASS-SVN] r71740 - grass-addons/grass7/vector/v.gsflow.grid

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 15 22:34:49 PST 2017


Author: awickert
Date: 2017-11-15 22:34:48 -0800 (Wed, 15 Nov 2017)
New Revision: 71740

Modified:
   grass-addons/grass7/vector/v.gsflow.grid/v.gsflow.grid.py
Log:
v.gsflow.grid: 2-part r.mapcalc overwrite for Windows


Modified: grass-addons/grass7/vector/v.gsflow.grid/v.gsflow.grid.py
===================================================================
--- grass-addons/grass7/vector/v.gsflow.grid/v.gsflow.grid.py	2017-11-16 06:34:20 UTC (rev 71739)
+++ grass-addons/grass7/vector/v.gsflow.grid/v.gsflow.grid.py	2017-11-16 06:34:48 UTC (rev 71740)
@@ -195,7 +195,8 @@
         # Coarse resolution region:
         g.region(w=str(_w), e=str(_e), s=str(_s), n=str(_n), nsres=str(grid_ratio_ns*reg['nsres']), ewres=str(grid_ratio_ew*reg['ewres']))
         r.resamp_stats(input=mask, output=mask, method='sum', overwrite=True, quiet=True)
-        r.mapcalc(mask+' = '+mask+' > 0', overwrite=True, quiet=True)
+        r.mapcalc('tmp'+' = '+mask+' > 0', overwrite=True, quiet=True)
+        g.rename(raster=('tmp',mask), overwrite=True, quiet=True)
         r.null(map=mask, null=0, quiet=True)
         # Add mask location (1 vs 0) in the MODFLOW grid
         v.db_addcolumn(map=grid, columns='basinmask double precision', quiet=True)
@@ -222,12 +223,14 @@
         # May not work with dx != dy!
         v.to_rast(input=pp, output='tmp', use='val', value=1, overwrite=True)
         r.buffer(input='tmp', output='tmp', distances=float(dx)*1.5, overwrite=True)
-        r.mapcalc('tmp = (tmp == 2) * '+raster_input, overwrite=True)
+        r.mapcalc('tmp2 = (tmp == 2) * '+raster_input, overwrite=True)
+        g.rename(raster=('tmp2','tmp'), overwrite=True, quiet=True)
         #r.mapcalc('tmp = if(isnull('+raster_input+',0,(tmp == 2)))', overwrite=True)
         #g.region(rast='tmp')
         #r.null(map=raster_input,
         r.drain(input=raster_input, start_points=pp, output='tmp2', overwrite=True)
-        r.mapcalc('tmp = tmp2 * tmp', overwrite=True)
+        r.mapcalc('tmp3 = tmp2 * tmp', overwrite=True, quiet=True)
+        g.rename(raster=('tmp3','tmp'), overwrite=True, quiet=True)
         r.null(map='tmp', setnull=0)
         r.to_vect(input='tmp', output=bc_cell, type='point', column='z',
                   overwrite=gscript.overwrite(), quiet=True)



More information about the grass-commit mailing list