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.
Chris
On Monday 21 July 2008, 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.
Chris
_________________________________________________________________
how about standard deviation or variance? these would give you an idea of how
homogeneous the elevation data are within each window: higher values in steep
uplands, with lower values in the valleys.
Cheers,
Dylan
--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341
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
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.
By "average" are you referring to the mean difference, or the mean
absolute difference?
If it's the mean difference:
sum(x[i] - x[centre]) / count
= sum(x[i]) / count - x[centre]
so you can use "r.neighbors method=average" then subtract the original
map from the result with r.mapcalc.
OTOH, if it's the absolute difference (or anything else where you
can't rearrange it so that the operation falls outside of the
summation), you'll need to extend r.neighbors (you could use
r.mapcalc, but that's both slow and ugly if you have a large
neighborhood).
--
Glynn Clements <glynn@gclements.plus.com>
I wrote a little module that does this sort of calculation a while ago.
If I remember right, it worked reasonably well and also does
normalization either by neighborhood or map maximum. I have attached
the code and Makefile.
Have fun with it,
Ben
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.
Chris
------------------------------------------------------------------------
------------------------------------------------------------------------
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
--
Benjamin Ducke
Senior Applications Support and Development Officer
Oxford Archaeological Unit Limited
Janus House
Osney Mead
OX2 0ES
Oxford, U.K.
Tel: +44 (0)1865 263 800 (switchboard)
Tel: +44 (0)1865 980 758 (direct)
Fax :+44 (0)1865 793 496
benjamin.ducke@oxfordarch.co.uk
------
Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit http://iso26300.info for more information.
(attachments)
main.c (12.4 KB)
Makefile (197 Bytes)