[GRASS-user] About Matrix Weights
glynn at gclements.plus.com
Fri Nov 15 07:08:29 PST 2013
Luis Miguel Royo Perez wrote:
> I hope someone can explain how works the option /"matrix weights" /of
> the *r.neighbors* program. I've been trying to find out for myself but
> I'm really confused. I've read the documentation but it's no clear for
> me in this aspect.
> What I've trying to do to find out how works it the next:
> 1st I've created a random matrix 5x5 with values from 1-25 randomly
> 2nd I've done four different matrix, 0, 1, 5, 10, for all the values in
> a 3x3 window,
> for the first one (0), all the values are NULL.
> for the rest I have the same result... :S Why?
> I know i'm missing something, but I don't know what is it. I would
> aprecciate some help in this point.
The way that weights are used depends upon the specific aggregate
(method) being used.
However, most of the aggregates have the property that multiplying all
of the weights by the same factor won't change the final result (an
exception is method=count).
Also, most (if not all) of them have the properties that an integer
weight of N is equivalent to N occurrences of the cell value, and
having all weights equal to one produces the same result as when
weights are not used.
When weights are used, the calculation for method=average is:
sum(w[i]*x[i]) / sum(w[i])
In the case where all weights are zero, this will end up with both the
numerator and denominator to zero, which produces a null result.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user