[GRASSLIST:4461] Re: mode()

Glynn Clements glynn.clements at virgin.net
Mon Oct 4 11:52:17 EDT 2004


Maciek Sieczka wrote:

> Still no any answer so let me bug you a little more. I was thinking of
> putting a bug report on this issue but first of all I don't know how to
> describe it because it's weird and secondly COULD ANYBODY CHECK IF YOU CAN
> REPRODUCE THE ERROR so I could make sure if I'm not a separated case? It's
> hard for me to believe that such a nasty bug would survive in r.mapcalc and
> I'm ready to be convinced that it's all my fault somehow.

Both the mode and median functions are similarly broken.

For f_mode (in xmode.c), the expression:

	value[i] = (double) argv[j][i];

should be:

	value[j] = (double) argv[j][i];

Similarly, for f_median (in xmedian.c), the expression:

	a[i] = argv[j][i];

should be:

	a[j] = argv[j][i];

I'll commit a fix to CVS shortly.

BTW, it isn't that unlikely that such a bug would survive. There have
been more significant bugs which have existed for longer.

E.g. floating-point rasters which crossed the 180-degree meridian
didn't work (at all) from the point that floating-point rasters were
added up until a couple of weeks ago.

The size of the GRASS code base is on the same scale as XFree86 or the
Linux kernel, but we probably only have a thousandth as many users as
either of those. The end result is there is a significant amount of
code which has either never been executed, or has only been executed a
few times.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list