[GRASS-SVN] r66778 - grass-addons/grass7/imagery/i.segment.stats
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Nov 11 06:36:09 PST 2015
Author: mlennert
Date: 2015-11-11 06:36:09 -0800 (Wed, 11 Nov 2015)
New Revision: 66778
Modified:
grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
Log:
correct use of findfile for rasters ('cell') and respect region settings except if flag is used
Modified: grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
===================================================================
--- grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py 2015-11-10 21:53:54 UTC (rev 66777)
+++ grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py 2015-11-11 14:36:09 UTC (rev 66778)
@@ -69,7 +69,12 @@
#%rules
#% required: csvfile,vectormap
#%end
+#% flag
+#% key: r
+#% description: Adjust region to input map
+#%END
+
import os
import atexit
import collections
@@ -82,7 +87,7 @@
if grass.find_file(temporary_vect, element='vector')['name']:
grass.run_command('g.remove', flags='f', type_='vector',
name=temporary_vect, quiet=True)
- if grass.find_file(temporary_clumped_rast, element='raster')['name']:
+ if grass.find_file(temporary_clumped_rast, element='cell')['name']:
grass.run_command('g.remove', flags='f', type_='raster',
name=temporary_clumped_rast, quiet=True)
if insert_sql:
@@ -91,7 +96,6 @@
def main():
- grass.use_temp_region()
segment_map = options['map']
csvfile = options['csvfile'] if options['csvfile'] else []
@@ -117,7 +121,10 @@
'coeff_var': 11, 'variance': 10, 'sum_abs': 13, 'perc_90': 17,
'mean': 7}
- grass.run_command('g.region', raster=segment_map)
+ if flags['r']:
+ grass.use_temp_region()
+ grass.run_command('g.region', raster=segment_map)
+
grass.run_command('r.clump',
input_=segment_map,
output=temporary_clumped_rast,
More information about the grass-commit
mailing list