[GRASS-dev] GRASS 7 r.neighbours average method giving incorrect value

Glynn Clements glynn at gclements.plus.com
Thu Jul 11 04:30:53 PDT 2013


Allar Haav wrote:

> I noticed today that "average" method in r.neighbours gives an incorrect 
> value. Let me give you an example:

> 3) Judging from previous steps, it should be only logical that the 
> output raster has values from 0 to 1. However it seems that 0.5 has been 
> added:


When the output is an integer map, the result of the average, variance
and stddev methods is supposed to be rounded to the nearest integer
(rather than towards zero), so 0.5 is added prior to truncation.

r54820 removed the option to generate integer output maps, so the
"is the output map integer" check became redundant. But rather than
changing it to never adding 0.5, now it's always added.

This should be fixed by r57064.

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


More information about the grass-dev mailing list