[GRASS5] raster category confusion

Glynn Clements glynn at gclements.plus.com
Thu Sep 1 08:21:24 EDT 2005


Markus Neteler wrote:

> > Forget about r.cats (and categories in general). This:
> > 
> > > r.stats -1 one
> > > 120
> > > 156
> > > 99
> > > 100
> > > 120
> > > 156
> > > 99
> > > 100
> > 
> > is a lot more interesting (and relevant).
> 
> OK:
> 
> in r.stats:
> 
> main.c 
>  G_get_range_min_max (&range, &min, &max);
>  min =1
>  max =1
> 
> ok so far.
> raw_stats (fd, verbose, with_coordinates, with_xy, with_labels);
>            fd     0           0               0          0
> 
> Entering raw_stats():
> raw_stats.c:49
>  rastp[i] = rast[i];
>  i=0
>  rastp[0]= void
> 
>  raw_stats.c:98, when i is 0, then
> *((CELL *) rastp[i]) is 120.
> 
> Then it prints 120 and so forth.
> 
> Should I add some G_debug() in raw_stats?

I'd start by examining the pointers rastp[0] and rast[0], and the
contents of the buffer to which they point, before entering the
"for (col = ..." loop. I.e.:

	print rast[0]
	print rastp[0]
	print *(CELL*)(rast[0])@50

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list