I found a bug! (I think)

Angus Carr acarr at iname.com
Sat Nov 13 12:54:16 EST 1999

This is a two-part message I have put together after I realized my mail to the
list was being filtered. Please excuse the slight incoherence caused by that.

I am in the middle of trying to classify an image. I have two files which 
are both in the current region, and no mask is set. They are the
two layers I would like to read in and classify. They are both in the group and

I just switched over from Grass 4 with this data, so I ran r.support, because
it was the right thing to do.

I get this response to this command. Both images show fine in the monitor.  
i.cluster g=g sub=g sig=g_unsup cl=24 sample=1,1 reportfile=/tmp/sigreport

Reading image ...  100%
ERROR: Not enough non-zero sample data points. Check your current region
            (and mask)

I tried it with all combinations of null values information, using r.support to
create it where needed.

The result, after some followup was:
In the file src/libes/imagery/c_point.c, line 30, there is a null
check in the function I_cluster_point which is misinterpreted.
      if (!G_is_c_null_value(&x[band])) return 1; //Wrong - should not have !
should read 
      if (  G_is_c_null_value(&x[band])) return 1;

The bug rejects all non-null points, which is probably incorrect (from the
perspective of someone with non-null points to analyze).

Angus Carr

More information about the grass-user mailing list