[GRASS-SVN] r74478 - grass-addons/grass7/imagery/i.segment.uspo
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri May 10 07:50:18 PDT 2019
Author: mlennert
Date: 2019-05-10 07:50:18 -0700 (Fri, 10 May 2019)
New Revision: 74478
Modified:
grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py
Log:
i.segment.uspo: check for 0 before division and provide alternative
Modified: grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py
===================================================================
--- grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py 2019-05-10 14:40:46 UTC (rev 74477)
+++ grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py 2019-05-10 14:50:18 UTC (rev 74478)
@@ -515,8 +515,14 @@
neighbordict, parms['indicator'])
autocor_per_raster.append(autocor)
- mean_lv = sum(variance_per_raster) / len(variance_per_raster)
- mean_autocor = sum(autocor_per_raster) / len(autocor_per_raster)
+ if len(variance_per_raster) > 0:
+ mean_lv = sum(variance_per_raster) / len(variance_per_raster)
+ else:
+ mean_lv = 999999
+ if len(autocor_per_raster) > 0:
+ mean_autocor = sum(autocor_per_raster) / len(autocor_per_raster)
+ else:
+ mean_autocor = 0
result_queue.put([mapname, mean_lv, mean_autocor, threshold, hr,
radius, minsize])
More information about the grass-commit
mailing list