[GRASS-user] RE: [GRASS-dev] More efficient to use r.mapcalc or r.patch in a l oop for creating mosaics?

Patton, Eric epatton at nrcan.gc.ca
Fri May 12 08:46:16 EDT 2006


Hamish,

Cool, I didn't know you could assign a delimited list for input to Grass
programs. I thought I needed to create an array to store all the input names
first. 

Thanks!

~ Eric.
 

-----Original Message-----
From: Hamish
To: Patton, Eric
Cc: grass-dev at grass.itc.it; grassuser at grass.itc.it
Sent: 5/12/2006 1:03 AM
Subject: Re: [GRASS-dev] More efficient to use r.mapcalc or r.patch in a l
oop for creating mosaics?

> Thanks for the reply. What if the maps aren't fed to r.patch in order
> of rows/columns, but in some random order with respect to the entire
> region (like alphabetical order, for instance).

If maps overlap at all, r.patch will use the values from the first map
listed as the value. So order matters.


> Here's a snippet from my script, for example:
> 
> 
> declare -a PATCHLIST
> 
> i=0
> for MAP in `g.mlist type=rast pattern=$INPUT` ; do
> 
> 	PATCHLIST[${i}]=${MAP}
> 	i=$((${i} + 1))
> done


why not just:

MAPS=`g.mlist pat="map_*" sep=,`
r.patch in=$MAPS out=patched_maps

or together

r.patch in="`g.mlist pat="map_*" sep=,`" out=patched_maps


note r.out.mpeg has wildcard code built-in for input maps.
Probably best not to go around adding this module by module. 
Into G_parser() [multiple="YES"], if at all.


Hamish




More information about the grass-user mailing list