[GRASS-user] filtering raster outliers

Ken Mankoff mankoff at gmail.com
Tue Feb 16 07:50:43 PST 2016

Hi GRASS list,

I'm trying to filter out some outliers on a raster map, and wondering which approach is considered better. I'm also having trouble figuring out the exact syntax for the r.mapcalc approach.

I can remove the top and bottom 1% of outliers with this:

r.out.xyz input=map_in | r.in.xyz input=- output=map_out trim=1

An other option would be (something like) the following:

p=`r.univar map=RUh percentile=99 -e | grep "99th percentile:" | cut -d: -f2`
r.mapcalc "map_out = if(map_in * (map_in > ${p}), map_in, 0, 0)"

The xyz approach also filters the bottom and top 1%, while the mapcalc only filters the top 1%.

Other than that difference, are there other differences I'm not aware of? Which is a more "grassy" approach?



More information about the grass-user mailing list