[GRASS-user] Python calling landsat_toar function

Hi,
I am using Grass 7 beta 4 on Windows.

After importing Landsat raster bands, I use the following command that works fine.

i.landsat.toar --overwrite --verbose input=LC81900362014284LGN00_B output=ator metfile=C:\Users\Administrator\Downloads\LC81900362014284LGN00\LC81900362014284LGN00\LC81900362014284LGN00_MTL.txt

But when I try to do the same in the Python console (same software), I get the following error (please see below after code) complaining for the input prefix parameter. Note that I get the same error in my Python script on Linux using Grass7, so I supposed it is not related to the os. I guess it is caused by an error in the calling syntax (?)

import grass.script as grass → OK

from grass.pygrass.modules.shortcuts import imagery as i → OK

i.landsat_toar(input_prefix=“LC81900362014284LGN00_B”,output_prefix=outpref,metfile=“LC81900362014284LGN00_MTL.txt”, overwrite=“True”, quiet=“False”)

Traceback (most recent call last):
File “”, line 1, in
File “C:\Program Files (x86)\GRASS GIS 7.0.0beta4\etc\python\grass\pygrass\modules\interface\module.py”, line 602, in call
raise ParameterError(‘%s is not a valid parameter.’ % key)
ParameterError: input_prefix is not a valid parameter.

Thanks in advance

Hi,

2015-01-19 19:07 GMT+01:00 Pierric de Laborie <pierric.delaborie@gmail.com>:

i.landsat.toar --overwrite --verbose input=LC81900362014284LGN00_B
output=ator
metfile=C:\Users\Administrator\Downloads\LC81900362014284LGN00\LC81900362014284LGN00\LC81900362014284LGN00_MTL.txt

right, valid parameters are 'input' and 'output'.

i.landsat_toar(input_prefix="LC81900362014284LGN00_B",output_prefix=outpref,metfile="LC81900362014284LGN00_MTL.txt",
overwrite="True", quiet="False")

Use 'input' instead of 'input_prefix', and 'output' instead of
'output_prefix'. Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa

Hi,

On Jan 19, 2015 7:07 PM, “Pierric de Laborie” <pierric.delaborie@gmail.com> wrote:

Hi,
I am using Grass 7 beta 4 on Windows.

After importing Landsat raster bands, I use the following command that works fine.

i.landsat.toar --overwrite --verbose input=LC81900362014284LGN00_B output=ator metfile=C:\Users\Administrator\Downloads\LC81900362014284LGN00\LC81900362014284LGN00\LC81900362014284LGN00_MTL.txt

But when I try to do the same in the Python console (same software), I get the following error (please see below after code) complaining for the input prefix parameter. Note that I get the same error in my Python script on Linux using Grass7, so I supposed it is not related to the os. I guess it is caused by an error in the calling syntax (?)

import grass.script as grass → OK

from grass.pygrass.modules.shortcuts import imagery as i → OK

i.landsat_toar(input_prefix=“LC81900362014284LGN00_B”,output_prefix=outpref,metfile=“LC81900362014284LGN00_MTL.txt”, overwrite=“True”, quiet=“False”)

Traceback (most recent call last):
File “”, line 1, in
File “C:\Program Files (x86)\GRASS GIS 7.0.0beta4\etc\python\grass\pygrass\modules\interface\module.py”, line 602, in call
raise ParameterError(‘%s is not a valid parameter.’ % key)
ParameterError: input_prefix is not a valid parameter.

In beta4 we have basically concluded the parameter name standardization which is essentially a simplification.

In this case the parameter has been renamed to ‘input’.

You can look it up here:

https://trac.osgeo.org/grass/wiki/Grass7/NewFeatures#Imagerymodulechanges

Hope this helps
Markus