[GRASS-SVN] r72832 - grass/trunk/scripts/r.drain
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 14 19:38:17 PDT 2018
Author: annakrat
Date: 2018-06-14 19:38:17 -0700 (Thu, 14 Jun 2018)
New Revision: 72832
Modified:
grass/trunk/scripts/r.drain/r.drain.py
Log:
r.drain: pep8 changes - mixed tabs and spaces, removed forgotten print
Modified: grass/trunk/scripts/r.drain/r.drain.py
===================================================================
--- grass/trunk/scripts/r.drain/r.drain.py 2018-06-14 20:27:04 UTC (rev 72831)
+++ grass/trunk/scripts/r.drain/r.drain.py 2018-06-15 02:38:17 UTC (rev 72832)
@@ -115,11 +115,12 @@
def cleanup():
"""Delete temporary direction map."""
if tmp_maps:
- try:
- grass.run_command("g.remove", flags='f', quiet=True, type='raster', name=tmp_maps)
- except:
- pass
+ try:
+ grass.run_command("g.remove", flags='f', quiet=True, type='raster', name=tmp_maps)
+ except:
+ pass
+
def main():
valmap = options['input']
dirmap = options['direction']
@@ -131,15 +132,14 @@
global tmp_maps
tmp_maps = False
atexit.register(cleanup)
-
+
if not dirmap:
- # get directions with r.fill.dir, without sink filling
- dirmap = "%s_tmp_%d" % (valmap, os.getpid())
- fill_map = "%s_fill_%d" % (valmap, os.getpid())
- area_map = "%s_area_%d" % (valmap, os.getpid())
- tmp_maps = dirmap + ',' + fill_map + ',' + area_map
- print tmp_maps
- grass.run_command("r.fill.dir", input=valmap, output=fill_map, direction=dirmap, areas=area_map, flags='f', format='grass');
+ # get directions with r.fill.dir, without sink filling
+ dirmap = "%s_tmp_%d" % (valmap, os.getpid())
+ fill_map = "%s_fill_%d" % (valmap, os.getpid())
+ area_map = "%s_area_%d" % (valmap, os.getpid())
+ tmp_maps = dirmap + ',' + fill_map + ',' + area_map
+ grass.run_command("r.fill.dir", input=valmap, output=fill_map, direction=dirmap, areas=area_map, flags='f', format='grass')
# create args for r.path
kwargs = {}
@@ -147,24 +147,23 @@
kwargs['values'] = valmap
kwargs['format'] = 'degree'
if start_coords:
- kwargs['start_coordinates'] = start_coords
+ kwargs['start_coordinates'] = start_coords
if start_pnts:
- kwargs['start_points'] = start_pnts
+ kwargs['start_points'] = start_pnts
if rpathmap:
- kwargs['raster_path'] = rpathmap
+ kwargs['raster_path'] = rpathmap
if vpathmap:
- kwargs['vector_path'] = vpathmap
+ kwargs['vector_path'] = vpathmap
pathflags = ''
if flags['c']:
- pathflags += 'c'
+ pathflags += 'c'
if flags['a']:
- pathflags += 'a'
+ pathflags += 'a'
if flags['n']:
- pathflags += 'n'
+ pathflags += 'n'
grass.run_command("r.path", flags=pathflags, **kwargs)
-
return 0
More information about the grass-commit
mailing list