Aggregation problems

Jim Westervelt westerve at zorro.cecer.army.mil
Sat Oct 10 20:32:38 EDT 1992


# We are trying to aggregate cells (say 3x3 or 10x10) and compute
# an average for that entire area.

Try using r.neighbors to average values over a number of cells (odd number
required), and then cut the resolution down by the corresponding amount.

e.g.
Let's say you want to average in a 5x5 region for a map called "elev"

g.region rast=elev
  Let's say this map is a 50m resolution 
r.neighbors input=elev output=elev.avg method=average size=5
  You now have the averages you want, but the original rows and cols
g.region res=250
  250 = 5 * 50 (50 is the original res and 5 is the size input above)
r.mapcalc elev.avg=elev.avg
  elev.avg gets resampled every 5 rows and 5 cols (cutting memory by 25 times)



More information about the grass-user mailing list