[GRASS-SVN] r72028 - grass/trunk/scripts/r.grow
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 4 08:54:49 PST 2018
Author: marisn
Date: 2018-01-04 08:54:48 -0800 (Thu, 04 Jan 2018)
New Revision: 72028
Modified:
grass/trunk/scripts/r.grow/r.grow.py
Log:
r.grow: Do not pass @mapset part to r.mapcalc as it will trigger syntax error.
See r.mapcalc bug #3475
Modified: grass/trunk/scripts/r.grow/r.grow.py
===================================================================
--- grass/trunk/scripts/r.grow/r.grow.py 2018-01-04 15:25:21 UTC (rev 72027)
+++ grass/trunk/scripts/r.grow/r.grow.py 2018-01-04 16:54:48 UTC (rev 72028)
@@ -64,6 +64,7 @@
import os
import atexit
import math
+from string import split
import grass.script as grass
from grass.exceptions import CalledModuleError
@@ -84,7 +85,6 @@
global temp_dist, temp_val
input = options['input']
- output = options['output']
radius = float(options['radius'])
metric = options['metric']
old = options['old']
@@ -122,6 +122,16 @@
if not grass.find_file(input)['file']:
grass.fatal(_("Raster map <%s> not found") % input)
+ # Workaround for r.mapcalc bug #3475
+ # Mapcalc will fail if output is a fully qualified map name
+ out_name = split(options['output'], '@')
+ if len(out_name) == 2:
+ if out_name[1] != grass.gisenv()['MAPSET']:
+ grass.fatal(_("Output can be written only to the current mapset"))
+ output = out_name[0]
+ else:
+ output = out_name[0]
+
if shrink == False:
try:
grass.run_command('r.grow.distance', input=input, metric=metric,
More information about the grass-commit
mailing list