[GRASS-dev] GRASS r.neighbors

Moritz Lennert mlennert at club.worldonline.be
Mon Jul 21 14:24:29 EDT 2008


On 21/07/08 19:53, chris carleton wrote:
> I've encountered another challenge with GRASS that I need some expert 
> advice with. I want to run a neighborhood analysis on a few DEMs, but 
> the options in r.neighbors don't quite seem to suit my needs. I want an 
> analysis that calculates the average difference between the central cell 
> and its neighbors (using that average as the new cell cat value). The 
> idea is that I'll end up with an approximation of terrain 'ruggedness' 
> by looking at average differences in elevation within a given 
> neighborhood. Any suggestions would be welcome.

How about something like:

r.mapcalc newMap = (abs(oldMap[0,0]-oldMap[-1,1]) + 
abs(oldMap[0,0]-oldMap[-1,0]) + abs(oldMap[0,0]-oldMap[-1,-1]) + etc ) /8

?

Moritz


More information about the grass-dev mailing list