Bläddra i källkod

r.grow: Do not pass @mapset part to r.mapcalc as it will trigger syntax error.
See r.mapcalc bug https://trac.osgeo.org/grass/ticket/3475


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@72028 15284696-431f-4ddb-bdfa-cd5b030d7da7

Maris Nartiss 7 år sedan
förälder
incheckning
9758c174b6
1 ändrade filer med 11 tillägg och 1 borttagningar
  1. 11 1
      scripts/r.grow/r.grow.py

+ 11 - 1
scripts/r.grow/r.grow.py

@@ -64,6 +64,7 @@ import sys
 import os
 import atexit
 import math
+from string import split
 import grass.script as grass
 from grass.exceptions import CalledModuleError
 
@@ -84,7 +85,6 @@ def main():
     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 @@ def main():
     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,