[GRASS-dev] Access multiple files in a Python script file

Luis Lisboa luislisboa1975 at gmail.com
Thu Feb 18 04:03:18 EST 2010


Thanks Glynn. Regarding the split function, is is part of GRASS pythin
Scripting Library or from normal Python library?
And how can I access an item from the rastermaps list? using rastermaps[0]
and rastermaps[1]?

Thank you

On Wed, Feb 17, 2010 at 7:12 PM, Glynn Clements <glynn at gclements.plus.com>wrote:

>
> Luis Lisboa wrote:
>
> > I'm working on 6.4.0 version and I want to build a Python scripts that
> acess
> > multiple files. From GRASS7 i.spectral I see that raster variable is a
> > multiple and this is performed.
> > raster = options['raster']
> > rastermaps = raster.split(',')
> >
> > My question is regarding this: how can I access second file for, for
> > instance, do a mapcalc or a for cycle?
>
> The .split() method returns a list, so in the above case you can use
> e.g.:
>
>        for map in rastermaps:
>            ...
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20100218/830832a4/attachment.html


More information about the grass-dev mailing list