[GRASS5] raster category confusion
Markus Neteler
neteler at itc.it
Wed Aug 31 11:50:37 EDT 2005
On Tue, Aug 30, 2005 at 11:14:44PM +0100, Glynn Clements wrote:
>
> Markus Neteler wrote:
>
> > > Do you have some other mapset in the search path ahead of the current
> > > mapset?
> >
> > GRASS 6.1.cvs (spearfish60):/hardmnt/thuille0/ssi/grassdata/spearfish60 > g.mapsets -p
> > neteler PERMANENT user1
> >
> > It seems that there is only this single map gives wrong results.
> > It's a 32bit RHEL4 box.
>
> The only thing I can suggest is using a debugger.
To recall, the problem:
r.mapcalc "one=1"
r.cats one
Reading one in neteler ... 100%
99
100
120
156
Using the debugger, I found that unusual things happen in
G_next_cell_stat() in lib/gis/cell_stats.c
It loops over s->curoffset, and when s->curoffset gets to 35,
then
if ((*count = s->node[s->curp].count[s->curoffset]))
gets true (*count is 2 then, before it was 0).
idx is 16 then.
*cat = (idx<<SHIFT) + s->curoffset;
results in *cat = 99 then (s->curoffset is 35). After that G_next_cell_stat()
is left for the second loop where 100 results and so on.
SHIFT isn't known by the debugger (on top it is defined as 6 ).
I am pretty clueless.
Markus
More information about the grass-dev
mailing list