r.mapcalc

Angus Carr apcarr at FLASH.LakeheadU.CA
Tue Oct 21 05:10:26 EDT 1997


Try getting out of r.mapcalc and doing this as a shell script.
The syntax will vary.
This syntax works in BASH.
I am writing this off the top of my head, so you may need to play 
with it a bit.

=========== start script ====================

bigmap=,
for map in $LOCATION/$MAPSET/a12*970124 ; do
map2=`echo ${map} | sed "s/$LOCATION\/$MAPSET/,/"`
bigmap=`echo ${bigmap}${map2}`
done

map3=`echo ${bigmap} | sed "s/,,/ /" `
r.mapcalc max970124=max(${map3})

=========== end script =====================
This script assembles a comma-separated list of maps in ${bigmap}, 
trims the leading pair of commas from the list, and then runs 
r.mapcalc with them.

Good Luck!
Angus Carr.


> Hi GRASSers
> 
> I 've got two questions (which I hope not to be to silly ;-) )
> 
> -1-
> 
> Is it possible to use r.mapcalc to calculate the minimum, maximum and /
> or the average of raster layers with using UNIX wild cards ("*" in my
> case) such as:
> 
> r.mapcalc max970124=max(a12*970124*)
> 
> to calculate a raster layer called max970124 of the maximum of all
> raster layers matching "a12*970124".
> 
 



More information about the grass-user mailing list