Hi,
I’d like to calculate the sum of all raster values that belong to a certain group. This spatially organized group is also indicated by an overlay raster (same resolution). Finally I want to assign these sums to a new raster. That might sound slightly complicated but here an example:
Asume following initial raster map A with random values like:
1-2-1-1-3-4-3-4-2-5-2-3
and an overlay raster indicating 3 groups:
1-1-1-1-2-2-2-2-3-3-3-3
the sums for the groups are:
group 1 = 5
group 2 = 14
group 3= 12
so the final raster would be:
5-5-5-5-14-14-14-14-12-12-12-12
How can such a task be achieved in GRASS (7)?
Any ideas?
/Johannes
On 26/11/13 16:28, Johannes Radinger wrote:
Hi,
I'd like to calculate the sum of all raster values that belong to a
certain group. This spatially organized group is also indicated by an
overlay raster (same resolution). Finally I want to assign these sums to
a new raster. That might sound slightly complicated but here an example:
Asume following initial raster map A with random values like:
1-2-1-1-3-4-3-4-2-5-2-3
and an overlay raster indicating 3 groups:
1-1-1-1-2-2-2-2-3-3-3-3
the sums for the groups are:
group 1 = 5
group 2 = 14
group 3= 12
so the final raster would be:
5-5-5-5-14-14-14-14-12-12-12-12
How can such a task be achieved in GRASS (7)?
Any ideas?
r.statistics ?
Moritz
Yes of course, r.statistics resp. r.statistics2 is doing the job. I just mixed up the the maps when I tried it the first time.
Thanks Markus and Moritz!
···
On Thu, Nov 28, 2013 at 9:22 AM, Moritz Lennert <mlennert@club.worldonline.be> wrote:
On 26/11/13 16:28, Johannes Radinger wrote:
Hi,
I’d like to calculate the sum of all raster values that belong to a
certain group. This spatially organized group is also indicated by an
overlay raster (same resolution). Finally I want to assign these sums to
a new raster. That might sound slightly complicated but here an example:
Asume following initial raster map A with random values like:
1-2-1-1-3-4-3-4-2-5-2-3
and an overlay raster indicating 3 groups:
1-1-1-1-2-2-2-2-3-3-3-3
the sums for the groups are:
group 1 = 5
group 2 = 14
group 3= 12
so the final raster would be:
5-5-5-5-14-14-14-14-12-12-12-12
How can such a task be achieved in GRASS (7)?
Any ideas?
r.statistics ?
Moritz