[GRASS-SVN] r69773 - grass-addons/grass7/imagery/i.segment.uspo
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Nov 4 08:17:50 PDT 2016
Author: mlennert
Date: 2016-11-04 08:17:49 -0700 (Fri, 04 Nov 2016)
New Revision: 69773
Modified:
grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py
Log:
i.segment.uspo: the new i.segment needs much lower threshold values, so increasing decimal precision + workaround issue with qualified map names in windows
Modified: grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py
===================================================================
--- grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py 2016-11-04 13:23:35 UTC (rev 69772)
+++ grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py 2016-11-04 15:17:49 UTC (rev 69773)
@@ -367,6 +367,9 @@
autocor_per_raster = []
neighbordict = get_nb_matrix(mapname)
for raster in parms['rasters']:
+ # there seems to be some trouble in ms windows with qualified
+ # map names
+ raster = raster.split('@')[0]
var = get_variance(mapname, raster)
variance_per_raster.append(var)
autocor = get_autocorrelation(mapname, raster,
@@ -388,7 +391,7 @@
""" Do hierarchical segmentation for a vector of thresholds and a specific minsize"""
outputs_prefix = parms['temp_segment_map'] + "__%s" % parms['region']
- outputs_prefix += "__%.2f"
+ outputs_prefix += "__%.4f"
outputs_prefix += "__%d" % minsize
previous = None
map_list = []
@@ -423,7 +426,7 @@
""" Do non-hierarchical segmentation for a specific threshold and minsize"""
temp_segment_map_thresh = parms['temp_segment_map'] + "__%s" % parms['region']
- temp_segment_map_thresh += "__%.2f" % threshold
+ temp_segment_map_thresh += "__%.4f" % threshold
temp_segment_map_thresh += "__%d" % minsize
gscript.run_command('i.segment',
group=parms['group'],
@@ -692,7 +695,7 @@
iter_thresh = drange(start,stop,step)
# We want to keep a specific precision, so we go through string
# representation and back to float
- thresholds = [float(y) for y in ["%.2f" % x for x in iter_thresh]]
+ thresholds = [float(y) for y in ["%.4f" % x for x in iter_thresh]]
if options['minsizes']:
minsizes = [int(x) for x in options['minsizes'].split(',')]
More information about the grass-commit
mailing list