Hi,
On Sat, Mar 19, 2016 at 8:51 AM, <svn_grass@osgeo.org> wrote:
Author: marisn
Date: 2016-03-19 00:51:10 -0700 (Sat, 19 Mar 2016)
New Revision: 68080Modified:
grass/trunk/raster/r.neighbors/r.neighbors.html
Log:
r.neighbors: list all methods in documentation (fixes #2965); Provide an example of use (related to #2620)
...
+<h3>Measure occupancy of neighborhood</h3>
+
+Set up 10x10 computational region to aid visual inspection of results
<div class="code"><pre>
-r.neighbors
+g.region rows=10 cols=10
</pre></div>
Would you mind to change that to square pixels? I tried like this:
g.region n=229500 s=214500 w=630000 e=645000 res=1500 -p
but...
+Fill 50% of computational region with randomly located cells.
+"distance=0" will allow to fill adjacent cells.
+<div class="code"><pre>
+r.random.cells output=random_cells distance=0 ncells=50
+</pre></div>
+Count non-empty (not NULL) cells in 3x3 neighborhood
+<div class="code"><pre>
+r.neighbors input=random_cells output=counts method=count
+</pre></div>
+
+Optionally - exclude centre cell from the count (= only look around)
+<div class="code"><pre>
+r.mapcalc "cound_around = if( isnull(random_cells), counts, counts - 1)"
--> coun*t*s(?)_around?
The example is not that obvious yet, perhaps d.rast.num would enrich it.
Markus