[GRASS-dev] Some proposition on r.neighbour (new code)

Jarosław Jasiewicz jarekj at amu.edu.pl
Tue Feb 9 06:52:11 EST 2010


Hi All

I have two propositions on r.neighbour:

1) add existing method "range" to existing methods of r.neighbors
it is only only one line:

    {c_max, NULL, NO_CATS, 1, 0, "maximum", "highest value"},
+ {c_range, NULL, NO_CATS, 1, 0, "range", "maximum - minimum"},
    {c_stddev, w_stddev, NO_CATS, 0, 1, "stddev", "standard deviation"},


reason:
parameter "range" can be calculated as max-min, but it require three 
calculation: r.neigbour twice, and r.mapcalc one. For large maps and 
large window it takes lot of time. That parameter is broadly used in 
geomorphology as "relief energy" equivalent and as far as I know is 
frequently calculated (of course not only in GRASS GIS)

2) add new method "percentile" and add it to existing method of r.neighbours

I attached code as percentile2.c. For testing purpose I added it to 
directory r.neighbors, and add one line into methods:

    {c_perc, NULL, NO_CATS, 0, 0, "percentile", "percentile of center 
value"},

reason:
method "percentile" returns the percentile of the central cell. If it is 
max cell in the neighbor it returns 1 in smallest it returns 1/cell_count.
That parameter can be use in geomorphology to determine valleys (usually 
values lower than first quartile: 0.25) and ridges (usually values 
grater than 3th quartile 0.75). I send it to GRASS DEV Because I'd like 
to share this code with other grass users, and the easiest way is to add 
this parameter to GRASS is expand r.neighbors (creating ADD_ON 
r.neigbors fork or completely new module only for one parameter is 
nonsense).

regards
Jarek Jasiewicz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: percentile2.c
Type: text/x-csrc
Size: 674 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20100209/4bb850db/percentile2.bin


More information about the grass-dev mailing list