[GRASSLIST:8510] Re: neighbourhood analysis

Glynn Clements glynn at gclements.plus.com
Wed Oct 5 19:43:28 EDT 2005


Robert Nuske wrote:

> > I am trying to do landform analysis based on various elevational
> > variability charateristics. I wanted to used a circular focal point
> > moving window analysis. My DEM is 30m resolution. I am currently running
> > Grass 6.0 through Cygwin.
> >
> > I have tried using r.neighbours but it seems to limit my window size to
> > 25 pixels (750m), and what I can see only offers a square neighbourhood.
> > I would like to do my analysis over a 3000m area so I need a much larger
> > window. Is there a way to do this in GRASS without "growing" my raster
> > size or averaging the data prior to analysis?
> 
> you can add the needed window sizes to main.c within grass6/raster/r.neighbors
> 
> just change line 94, eg: 
> 	parm.size->options    = "1,3,5,7,9,11,13,15,17,19,21,23,25,100,500" ;

It's easier to just remove that line and manually check that the
window size is odd (the algorithm assumes this).

> and then compile r.neighbors again as described in the file INSTALL,
> section "(G) COMPILING INDIVIDUAL MODULES - OWN MODULES"
> 
> -> but larger windows will result in way longer computation times.
> 
> 
> Don't know what to do about circular moving windows, though. 
> Would like to give it a try myself, but didn't have time to delve into it.

To use a circular (or other non-square) window, you would just need to
reimplement the gather() function in gather.c.

I suggest pre-creating a bitmap of the cells comprising the window
rather than computing the Euclidian distance repeatedly.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-user mailing list