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

Glynn Clements glynn at gclements.plus.com
Mon Oct 30 15:29:59 EST 2006


Hamish wrote:

> with "r.resamp.stats method=sum", I'm seeing banding. Is this expected
> or a case of it including points falling on the northern and eastern
> bounds? so the same input cell gets counted for multiple output cells?
> i.e. is it doing ( <= x <= , <= y <= ) instead of ( <= x < , <= y < ) ?

Unless the destination resolution is an integer multiple of the source
resolution, the total number of source cells used for each destination
cell will vary.

E.g. if the source resolution is 10m, and the destination resolution
is 25m, then the output cells will be based upon grids of 2x2, 2x3,
3x2 and 3x3 source cells, in equal proportions.

For the "sum" aggregate, this will have a significant effect upon the
output, as a cell computed from 3x3 source cells will contain the sum
of over twice as many values as one based upon 2x2 source cells.

The banding effect should go away if you use the -w switch. That will
cause the aggregates to use proportional fractions of each source
cell's value, rather than attributing the entire source cell to
whichever destination cell contains the source cell's centre. E.g. in
the 10m->25m case, each destination cell will use values from 2.5x2.5
source cells (i.e. it will use 2x2 values with a weight of 1, 2x1+1x2
values with a weight of 0.5, and 1x1 value with a weight of 0.25).

Using the -w switch will probably also be a lot slower.

If the banding occurs with integer scale factors, or with -w, let me
know.

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




More information about the grass-dev mailing list