[GRASS-dev] r.resamp.stats method=sum artifacts

Glynn Clements glynn at gclements.plus.com
Thu Nov 2 20:03:03 EST 2006

Markus Neteler wrote:

> >> I've added r.resamp.stats and r.resamp.interp to the GUI menus.
> >> (Raster->Devel)
> >>
> >> should r.resample be tagged for future removal? (same result as with:
> >> 'r.resamp.interp method=nearest' ???).
> >>     
> >
> > No.
> >
> > r.resample uses libgis' built-in resampling, so it is guaranteed to
> > resample in an identical manner to other commands.
> >
> > "r.resamp.interp method=nearest" performs the resampling itself, so it
> > could produce slightly different results due to rounding errors. The
> > method=nearest option was only included for completeness; if you want
> > nearest-neighbour resampling, r.resample is preferred.
> Honestly, this sounds confusing to me. Having NN method twice which produces
> slightly different results, is hard to explain to users.

It's largely inevitable.

Even if r.resample is removed, it can (mostly) be duplicated with e.g. 
"r.mapcalc dst = src", which also isn't guaranteed to produce the same
results as r.resamp.interp. Similarly for any other module which can
be made to perform a "copy" operation by some setting of its
parameters (r.mfilter with a 1x1 kernel, maybe?).

I could remove method=nearest from r.resamp.interp, but if it's ever
extended to support more advanced interpolation schemes with
parameters, the same issue could arise.

Ultimately, nearest-neighbour resampling will always have boundary
cases where the centre of an output cell falls on the boundary between
two or four input cells. In that situation, the end result will depend
upon everything which can affect the rounding error: the algorithm
used, the compiler, the compilation switches, the architecture, etc.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list