[GRASS-user] Python calling landsat_toar function

Markus Neteler neteler at osgeo.org
Mon Jan 19 10:13:40 PST 2015


Hi,

On Jan 19, 2015 7:07 PM, "Pierric de Laborie" <pierric.delaborie at 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 "<input>", line 1, in <module>
>   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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150119/72054775/attachment.html>


More information about the grass-user mailing list