r.rdfilter creates a new raster map using a focal filter. Thus each cell category value depends on the values around that cell. Instead of a moving window (e.g. r.neighbors) a "real distance filter" based on cost is applied.

The user can select the distance around each cell which is considered for the new value as well as the statistical value (mean,median,min,max).


A r.cost-approach is used to generate buffers for the user supplied distance for each raster cell ("filter window"). A statistical focal value is assign to each cell in a looped process. Since this module involves a loop over all raster cells and the computational expensive process r.cost, r.rdfilter can take a long time, especially for larger raster input maps.


Create a raster map of dominant geological material of a stream in a given distance up and downstream
# Extract a stream from spearfish dataset for sample application
r.watershed -f elevation="elevation.10m@PERMANENT" accumulation="accum"
r.mapcalc "accum_abs = abs(accum)" elevation="elevation.10m@PERMANENT" threshold=200 stream_rast="stream" direction="dirs" dir="dirs" coors="602140,4927950" basins="basins"
r.mapcalc "sample_stream = basins && stream"

# Extract geological information for sample stream course
r.mapcalc "geology_sample_stream = if(sample_stream,geology@PERMANENT,null())"

# Calculate median geological material ("median category value") for
# 1500 m up- and downstream of each stream cell input=geology_sample_stream stat=median distance=1500




Johannes Radinger
Leibniz-Institute of Freshwater Ecology and Inland Fisheries (IGB)
Berlin, Germany

Last changed: $Date$