So I was using this function called i.segment.uspo and I got this error

ERROR: Insufficient number of non-NULL cells in current region Traceback (most recent call last): File "/usr/lib/grass72/scripts/i.segment.uspo", line 935, in main() File "/usr/lib/grass72/scripts/i.segment.uspo", line 838, in main for mapname, lv, autocor, threshold, minsize in iter(result_queue.get, 'STOP'): ValueError: need more than 1 value to unpack

now both of my raster and vector are in the same coordinate reference system which is 2100. My vector data are polygons and where created in QGIS so they could represent different land-covers and my raster was clipped, again, in QGIS so that NULL values would be removed. Is there a way to fix that error?


the code:

CATS="$(v.db.select -c map=train_vec columns=cat)"
for i in $CATS 
v.extract --overwrite input=train_vec type=area where=$where output=$regionname
g.region --overwrite vector=$regionname save=region_uspo_$i

i.segment.uspo --overwrite group=OBIAgera output=/home/user/Desktop/res/obiatest_$i.csv segment_map=best_gera_$i region=region_uspo_$i threshold_start=0.601 threshold_stop=0.901 threshold_step=0.001 minsizes=8 memory=4000 processes=4

r.to.vect --overwrite input=best_vec_"$i"_region_uspo_vec_corine_"$i"_rank1 output=temp_best_$i type=area
v.out.ogr --overwrite input=temp_best_$i type=area output=/home/user/Desktop/resaults/res_$i.shp

The error most likely comes from i.segment.uspo but I don't know if it's because of my training areas (basically the regions) or because of something else

P.S the code was based on a python algorithm which I decided to do it in shell script for my thesis.

EDIT 2 Here is the source code of the command and it stops somewhere around here:

837         if rg:
838             for mapname, lv, autocor, threshold, minsize in iter(result_queue.get, 'STOP'):
839                 regional_maplist.append(mapname)
840                 variancelist.append(lv)
841                 autocorlist.append(autocor)
842                 threshlist.append(threshold)
843                 minsizelist.append(minsize)
  • did you set g.region to your raster region (this you always have to do before doing anything in grass) Are you using grass plugin or standalone? Please share your commands
    – Elio Diaz
    Sep 25, 2017 at 15:18
  • @ElioDiaz see my edits
    – Ka_Papa
    Sep 27, 2017 at 10:23

1 Answer 1


Yeah, so apparently there is an issue with the code of the extension. there should be something like *result_queue.get because I'm sending multiple values in a list that accepts one value. So, I guess that was the issue. That can be changed by ignoring the "default values" and giving the value that you want, even if it's the default one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.