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

Allar Haav allar.haav at gmail.com
Wed Jul 10 09:42:00 PDT 2013


Hi,

I noticed today that "average" method in r.neighbours gives an incorrect 
value. Let me give you an example:
1) I have a raster soiltype1 consisting of 0's and 1's:

r.univar map=soiltype1 at soil percentile=100
total null and non-null cells: 35000000
total null cells: 10299386
Of the non-null cells:
----------------------
n: 24700614
minimum: 0
maximum: 1
range: 1
mean: 0.0678528
mean of absolute values: 0.0678528
standard deviation: 0.251493
variance: 0.0632488
variation coefficient: 370.645 %
sum: 1676006


2) I want to get the ratio of 0s and 1s in a neighbourhood for each 
cell. Therefore I run the command 'r.neighbors input=soiltype1 at soil 
output=soiltype1_avg size=11 method=average'

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:

r.univar map=soiltype1_avg at soil percentile=100
total null and non-null cells: 35000000
total null cells: 9921008
Of the non-null cells:
----------------------
n: 25078992
minimum: 0.5
maximum: 1.5
range: 1
mean: 0.567911
mean of absolute values: 0.567911
standard deviation: 0.200923
variance: 0.0403699
variation coefficient: 35.3792 %
sum: 14242639.875584


Is there any explanation for this behaviour? I doubt it is supposed to 
do that, am I right?
I'm using WinGRASS 7 revision 57043.

Regards,
Allar


More information about the grass-dev mailing list