[GRASSLIST:4588] Re: aggregate a higher resolution to a lower resolution

Glynn Clements glynn.clements at virgin.net
Thu Sep 26 04:45:59 EDT 2002


Markus Neteler wrote:

> > > I would like to aggregate my map from a 250x250m resolution to a 500x500m 
> > > resolution. If I use resample the nearest neighbor is used. Is there a 
> > > possibility to just average 4 250x250m blocks (like overlay a grid and 
> > > average) instead of nearest neigbor? So that I derive a mean and a variance?
> > 
> > Apart from r.resample, there's also r.resamp.rst, which does spline
> > interpolation. However, I'm not aware of anything which resamples
> > using a simple average.
> 
> Maybe already answered...
> Doesn't r.neighbor method=average size=something do the job?

No. The map which r.neighbors generates has the same resolution as
the input map, using a moving window.

Ulrich is looking for something which maps multiple input cells to a
single output cell. Similar to r.resample/r.resamp.rst, but using an
average rather than nearest-neighbour (r.resample, i.e. the automatic
resampling built into the libgis raster functions) or spline
interpolation (r.resamp.rst).

Unfortunately, this isn't straightforward (or efficient) to implement,
as libgis' raster handling assumes a common region and resolution
(i.e. cellhd) for all input and output maps.

The easiest approach would be r.neighbors to perform the average,
followed by g.region/r.resample to downsample the data. *Except* that
r.neighbors only allows odd-sized windows (so that there is an
unambiguous "centre" cell).

The simplest solution is to modify r.neighbors to allow even window
sizes.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-user mailing list