[R-sig-Geo] Function to smooth grids using n x n window moving average (low-pass filter)
p.hiemstra at geo.uu.nl
Mon Feb 21 14:55:54 CET 2011
On 01/19/2011 05:56 PM, piero campa wrote:
> Very quick method Paul,
> I tried on my own by simple pixel by pixel computing and the result is much
> Good work.
> Anyway I was trying to understand how to yield a small modification to your
> having a SpatiaGridDataFrame with NA holes, I noticed that the borderline
> pixels turn to NA too (and that's because x + NA = NA in R by default),
> letting theholes grow proportionally to the kernel size (just like the
> border pixels in a fullgrid data frame).
> I was trying to do add the ability to ignore NAs (just like it's in the sum
> method with na.rm = TRUE).
> I can't find the way however.
> Thank for any suggestion !
It can probably be done relatively fast, but I would try and use the
functions Robert Hijmans suggested. They are much more generic than my
approach and probably just as fast, or even faster.
Paul Hiemstra, MSc
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 253 5773
currently @ KNMI
More information about the R-sig-Geo