[GRASS-SVN] r73028 - grass/trunk/scripts/r.grow
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Aug 2 22:50:14 PDT 2018
Author: zarch
Date: 2018-08-02 22:50:14 -0700 (Thu, 02 Aug 2018)
New Revision: 73028
Modified:
grass/trunk/scripts/r.grow/r.grow.py
Log:
r.grow: Remove the use of split function in the string module (not supported in python3) and remove unused import
Modified: grass/trunk/scripts/r.grow/r.grow.py
===================================================================
--- grass/trunk/scripts/r.grow/r.grow.py 2018-08-02 19:54:23 UTC (rev 73027)
+++ grass/trunk/scripts/r.grow/r.grow.py 2018-08-03 05:50:14 UTC (rev 73028)
@@ -60,11 +60,10 @@
#% description: Value to write for "grown" cells
#%end
-import sys
import os
import atexit
import math
-from string import split
+
import grass.script as grass
from grass.exceptions import CalledModuleError
@@ -94,7 +93,7 @@
tmp = str(os.getpid())
temp_dist = "r.grow.tmp.%s.dist" % tmp
-
+
shrink = False
if radius < 0.0:
shrink = True
@@ -124,7 +123,7 @@
# Workaround for r.mapcalc bug #3475
# Mapcalc will fail if output is a fully qualified map name
- out_name = split(options['output'], '@')
+ out_name = options['output'].split('@')
if len(out_name) == 2:
if out_name[1] != grass.gisenv()['MAPSET']:
grass.fatal(_("Output can be written only to the current mapset"))
@@ -131,8 +130,8 @@
output = out_name[0]
else:
output = out_name[0]
-
- if shrink == False:
+
+ if shrink is False:
try:
grass.run_command('r.grow.distance', input=input, metric=metric,
distance=temp_dist, value=temp_val)
@@ -160,6 +159,7 @@
# write cmd history:
grass.raster_history(output)
+
if __name__ == "__main__":
options, flags = grass.parser()
atexit.register(cleanup)
More information about the grass-commit
mailing list