[GRASS-dev] r.multi

Glynn Clements glynn at gclements.plus.com
Wed Jun 28 13:28:50 EDT 2006


Hamish wrote:

> > I've wondered whether it would be worth having a general-purpose
> > "g.multi" command which executes a command "template" on multiple
> > maps. This first occurred to me in the context of handling colour
> > images as R/G/B channels; i.e. having a g.rgb command which would be
> > used like e.g. "g.rgb r.rescale in=inmap.% out=outmap.% ...", where
> > the % would be replaced with r/g/b on each run.
> > 
> > The main reason for not implementing it at that time was that, on the
> > one hand, it should probably be made more general, but on the other
> > hand, a more general version would require various options, and you
> > can't (currently) use G_parser() for a command which has an open-ended
> > list of options. Thus it would be necessary to extend G_parser() to
> > allow unknown options to be accepted.
> 
> some modules output to map.r map.g map.b, and some to map.1 map.2 map.3.
> not so general :-/

Yes, that's why it would need options, and hence G_parser().

> I've never fully understood the use of  "file {cell,cellhd}"
> could something like that be used?

You could use e.g.:

	for map in map.{r,g,b} ; do r.command in=$map ... ; done
or:
	for ext in {r,g,b} ; do r.command in=map.$ext out=out.$ext ... ; done

I was just thinking that:

	g.rgb r.command in=map.% out=out.% ...

might be more convenient.

It isn't a major issue.

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




More information about the grass-dev mailing list