[GRASSLIST:577] Change of spatial support

Dear list,

I am trying to change the spatial support (grid size) of some floating point
raster maps from 250x250m to 1000x1000m. It's a kind of upscaling or more
preciseley aggregation.

All I need to do is to superimpose the larger grid on the smaller grid and
compute the average and variance for the larger grid from the 4x4 250m cells
located within one 1000m cell.

I recognise that this is still not possible in GRASS. The GRASS resampling
methods for change of resolution, such as r.neigbors or g.region are not an
option as they do not provide a simple averaging method and the aggregation
error (variance).

I thought maybe r.mapcalc or R with it's grass6 interface could be used. But I
do not know how to achieve it in terms of code. Any sugegstions?

Ulrich

I am trying to change the spatial support (grid size) of some floating
point raster maps from 250x250m to 1000x1000m. It's a kind of
upscaling or more preciseley aggregation.

All I need to do is to superimpose the larger grid on the smaller grid
and compute the average and variance for the larger grid from the 4x4
250m cells located within one 1000m cell.

I recognise that this is still not possible in GRASS. The GRASS
resampling methods for change of resolution, such as r.neigbors or
g.region are not an option as they do not provide a simple averaging
method and the aggregation error (variance).

r.resample, r.resamp.rst

?
Hamish

On Wed, April 5, 2006 13:03, Hamish wrote:

I am trying to change the spatial support (grid size) of some floating
point raster maps from 250x250m to 1000x1000m. It's a kind of
upscaling or more preciseley aggregation.

All I need to do is to superimpose the larger grid on the smaller grid
and compute the average and variance for the larger grid from the 4x4
250m cells located within one 1000m cell.

I recognise that this is still not possible in GRASS. The GRASS
resampling methods for change of resolution, such as r.neigbors or
g.region are not an option as they do not provide a simple averaging
method and the aggregation error (variance).

r.resample, r.resamp.rst

?
Hamish

No r.resample uses the same method also nearest the neighbor method and does
not provide any calculation of summary statsitics within a larger grid cells.

r.resamp.rst does a re-interpolation of the raster cells. I am looking for an
aggregation of floating point raster cells for a lower grid resolution (4x4 =>
1x1). Simply take the average of a 4 x 4 raster cells and produce a single
mean value for a larger grid cell (but for floating point numbers not
integers).

Take 4 x 4 raster cells

2.5 3.5 1.5 0.5
2.5 3.5 1.5 0.5
2.5 3.5 1.5 0.5
2.5 3.5 1.5 0.5

compute the mean and variance to yield one raster cell with

mean = 2.0
var = 1.333

jump to next block of 4 x 4 raster cells which have not been used in previous
calculation and repeat the calculation and so on.

Any ideas for r.mapcalc?

Ulrich,

I was wondering if r.proj, selecting bilinear interpolation might work for you? I understand that all other projection parameters would be the same, except for the grid spacing (1000m vs 250m).

Tom

Ulrich Leopold wrote:

On Wed, April 5, 2006 13:03, Hamish wrote:
  

I am trying to change the spatial support (grid size) of some floating
point raster maps from 250x250m to 1000x1000m. It's a kind of
upscaling or more preciseley aggregation.

All I need to do is to superimpose the larger grid on the smaller grid
and compute the average and variance for the larger grid from the 4x4
250m cells located within one 1000m cell.

I recognise that this is still not possible in GRASS. The GRASS
resampling methods for change of resolution, such as r.neigbors or
g.region are not an option as they do not provide a simple averaging
method and the aggregation error (variance).
      

r.resample, r.resamp.rst

?
Hamish

No r.resample uses the same method also nearest the neighbor method and does
not provide any calculation of summary statsitics within a larger grid cells.

r.resamp.rst does a re-interpolation of the raster cells. I am looking for an
aggregation of floating point raster cells for a lower grid resolution (4x4 =>
1x1). Simply take the average of a 4 x 4 raster cells and produce a single
mean value for a larger grid cell (but for floating point numbers not
integers).

Take 4 x 4 raster cells

2.5 3.5 1.5 0.5

compute the mean and variance to yield one raster cell with

mean = 2.0
var = 1.333

jump to next block of 4 x 4 raster cells which have not been used in previous
calculation and repeat the calculation and so on.

Any ideas for r.mapcalc?

--
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL: thomas.adams@noaa.gov

VOICE: 937-383-0528
FAX: 937-383-0033

Ulrich Leopold wrote:

r.resamp.rst does a re-interpolation of the raster cells. I am looking for an
aggregation of floating point raster cells for a lower grid resolution (4x4 =>
1x1). Simply take the average of a 4 x 4 raster cells and produce a single
mean value for a larger grid cell (but for floating point numbers not
integers).

Take 4 x 4 raster cells

2.5 3.5 1.5 0.5
2.5 3.5 1.5 0.5
2.5 3.5 1.5 0.5
2.5 3.5 1.5 0.5

compute the mean and variance to yield one raster cell with

mean = 2.0
var = 1.333

jump to next block of 4 x 4 raster cells which have not been used in previous
calculation and repeat the calculation and so on.

Any ideas for r.mapcalc?

Create a base map where each 4x4 block has a unique category then use
r.average. E.g.

  r.mapcalc 'base = eval(i = (row() - 1)/4, j = (col() - 1)/4, (i+j) * (i+j+1) / 2 + j)'
  r.average base=base cover=inmap out=outmap

Reduce the region resolution by 4 then use r.resample.

Unfortunately, the r.average step is rather slow.

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