Vaclav Petras wenzeslaus at gmail.com
Thu Nov 14 19:58:24 PST 2013

```On Thu, Nov 14, 2013 at 1:42 PM, Luís Miguel Royo Pérez <
luis.miguel.royo at gmail.com> wrote:

> Of course!
>
> here is the command I'm using:
>
> r.neighbors --overwrite input=celdas.aleatorias.1-250 at PERMANENToutput=media1-250.pesos0 weight=/home/luismi/Escritorio/prueba_pesos0.txt
>
>  And the Matrix Weight is the next:
>
> 0 0 0
> 0 0 0
> 0 0 0
>
> This matrix is the same for 1, 5 and 10 values. I'm putting spaces between
> the numbers... is this correct?
>
>
> Spaces between numbers are OK (and newline for rows). You may want to try
the analyze test map created by r.mapcalc:

r.mapcalc expression="a_test = row()  - 1 + col() - 1"

0 1 2
1 2 3
2 3 4

r.neighbors input=a_test at PERMANENT output=a_neig method=sum weight=...

some weights:
1 10 1
10 1 1
1 1 1

method was sum (easy to count by hand), so result:

4 9 24
9 36 63
24 63 90

The center cell is
1*0 + 10*1 + 1*2 + 10*1 + 1*2 + 1*3 + 1*2 + 1*3 + 1*4  = 36

You are right, some example like this should be in the manual.

Zero weight really creates NULLs which is strange, I would expect zeros,
maybe bug.

Hope that helps, if not hopefully others can say something about it.

Vaclav

2013/11/14 Vaclav Petras <wenzeslaus at gmail.com>
>
>>
>>
>> On Thu, Nov 14, 2013 at 12:45 PM, Luis Miguel Royo Perez <
>> luis.miguel.royo at gmail.com> wrote:
>>
>>>  Hi everyone,
>>>
>>> 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
>>> disposed.
>>> 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.
>>>
>>> Hi, can you please post also the exact commands you are using to make it
>> clear? (I mean just copy from it command line or using Copy button in
>> module dialog.)
>>
>> Thanks,
>> Vaclav
>>
>>
>>> Thank you very much!!
>>>
>>> --
>>> Luís Miguel Royo Pérez
>>>
>>>
>>> _______________________________________________
>>> grass-user mailing list
>>> grass-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>>
>>
>>
>
>
> --
> Luís Miguel Royo Pérez.
>
> Av. Blasco Ibañez nº 1. Manises (Valencia)
> Teléfonos 679846103 y 961545792
> email: luis.miguel.royo at gmail.com
> web: www.inisig.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20131114/60caee36/attachment.html>
```