[GRASS-SVN] r73271 - grass-addons/grass7/imagery/i.segment.uspo

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 5 02:01:59 PDT 2018


Author: mlennert
Date: 2018-09-05 02:01:59 -0700 (Wed, 05 Sep 2018)
New Revision: 73271

Modified:
   grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py
Log:
i.segment.uspo: test result coming from worker function to catch errors

Modified: grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py
===================================================================
--- grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py	2018-09-05 08:54:10 UTC (rev 73270)
+++ grass-addons/grass7/imagery/i.segment.uspo/i.segment.uspo.py	2018-09-05 09:01:59 UTC (rev 73271)
@@ -855,23 +855,32 @@
         autocorlist = []
 
         if rg:
-            for mapname, lv, autocor, threshold, minsize in iter(result_queue.get, 'STOP'):
-                regional_maplist.append(mapname)
-                variancelist.append(lv)
-                autocorlist.append(autocor)
-                threshlist.append(threshold)
-                minsizelist.append(minsize)
+            for result in iter(result_queue.get, 'STOP'):
+                if len(result) == 5:
+                    mapname, lv, autocor, threshold, minsize = result
+                    regional_maplist.append(mapname)
+                    variancelist.append(lv)
+                    autocorlist.append(autocor)
+                    threshlist.append(threshold)
+                    minsizelist.append(minsize)
+                else:
+                    gscript.message('Error in worker function: %s' % result)
         else:
             hrlist = []
             radiuslist = []
-            for mapname, lv, autocor, threshold, hr, radius, minsize in iter(result_queue.get, 'STOP'):
-                regional_maplist.append(mapname)
-                variancelist.append(lv)
-                autocorlist.append(autocor)
-                threshlist.append(threshold)
-                hrlist.append(hr)
-                radiuslist.append(radius)
-                minsizelist.append(minsize)
+            for result in iter(result_queue.get, 'STOP'):
+                if len(result) == 7:
+                    mapname, lv, autocor, threshold, hr, radius, minsize = result
+                    regional_maplist.append(mapname)
+                    variancelist.append(lv)
+                    autocorlist.append(autocor)
+                    threshlist.append(threshold)
+                    hrlist.append(hr)
+                    radiuslist.append(radius)
+                    minsizelist.append(minsize)
+                else:
+                    gscript.message('Error in worker function: %s' % result)
+
 		
         maplist += regional_maplist
 	# Calculate optimization function values and get indices of best values



More information about the grass-commit mailing list