[GRASSLIST:7670] Re: r.statistics method=variance gives NAN
Glynn Clements
glynn at gclements.plus.com
Fri Jul 22 01:12:15 EDT 2005
Martin Wegmann wrote:
> when using r.statistics with method "variance" I receive NAN as output values,
> however if I use "average" or "stddev" the ouput looks reasonable.
>
> I tried it with GRASS 6.1-cvs a few weeks ago and GRASS 6.0 from the debian
> repository but both produced the same result.
>
> Any idea what the problem might be?
The m_var() function fails to initialise the local variable "s".
Fixed in CVS, or apply the attached patch.
--
Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
--- raster/r.statistics/o_var.c~ 2004-11-09 13:58:33.000000000 +0000
+++ raster/r.statistics/o_var.c 2005-07-22 06:07:18.000000000 +0100
@@ -107,6 +107,7 @@
*vari = 0.0;
ep = 0;
+ s = 0.0;
for(i = 0; i < n; i++) /* First pass to get the mean */
More information about the grass-user
mailing list