Gabriel Cotlier wrote:
I'm using grass 7.4.1 trying to export all raster layers in the current
mapset out of grass to a folder as GeoTiff files though a for loop from
the python shell as follows and I'm getting the error in red...
What could be the problem?
Thanks a lot in advance.
Regards,
Gabriel
>>>import grass.script as gscript
>>>rastlist=grass.read_command("g.list",type="rast")
>>>rastlist
F121996
F121997
F141999
F142000
Micha Silver:
Try:
rastlist=grass.read_command("g.list",type="rast").split()
[..]
For me it works like:
rasters=grass.read_command('g.list', type='raster',
separator='comma').split(',')
I wonder why the 'comma' is not mentioned for the separator option, when
asking for the module's help:
```
Lists available GRASS data base files of the user-specified data type
optionally using the search pattern.
Usage:
g.list [-iretmpf] type=datatype[,datatype,...] [pattern=string]
[exclude=string] [mapset=name[,name,...]] [separator=character]
[region=name] [output=name] [--overwrite] [--help] [--verbose]
[--quiet] [--ui]
Flags:
-i Ignore case
-r Use basic regular expressions instead of wildcards
-e Use extended regular expressions instead of wildcards
-t Print data types
-m Print fully-qualified map names (including mapsets)
-p Pretty printing in human readable format
-f Verbose listing (also list map titles)
Parameters:
type Data type(s)
options: raster,raster_3d,vector,label,region,group,all
pattern Map name search pattern (default: all)
exclude Map name exclusion pattern (default: none)
mapset Name of mapset to list (default: current search path)
separator Field separator
default: newline
region Name of saved region for map search (default: not restricted)
output Name for output file
```
This on
```
g.version -r
GRASS 7.5.svn (2018)
libgis Revision: 72327
libgis Date: 2018-03-06 12:12:44 +0100 (Tue, 06 Mar 2018)
```
Nikos
signature.asc
Description: PGP signature
_______________________________________________ grass-user mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/grass-user
