[GRASS-user] question on r.out.gdal in a loop
Gabriel Cotlier
gabiklm01 at gmail.com
Tue Jul 10 16:20:57 PDT 2018
Dear grass users,
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
>>>os.chdir('C:\\Users\\Gabriel\\Desktop\\out')
None
>>>for raster in rastlist:
... gscript.run_command('r.out.gdal', input=raster,
... output=raster + '.tiff',
format='GTiff')
Traceback (most recent call last):
File "<input>", line 3, in <module>
File
"C:\OSGEO4~1\apps\grass\grass-7.4.1\etc\python\grass\script\core.py", line
421, in run_command
return handle_errors(returncode, returncode, args, kwargs)
File
"C:\OSGEO4~1\apps\grass\grass-7.4.1\etc\python\grass\script\core.py", line
332, in handle_errors
returncode=returncode)
CalledModuleError: Module run None ['r.out.gdal', 'input=F',
'output=F.tiff', 'format=GTiff'] ended with error
Process ended with non-zero return code 1. See errors in the (error) output.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180710/9b3ce0ff/attachment.html>
More information about the grass-user
mailing list