[GRASS-user] landsat import with python-script

Hamish hamish_b at yahoo.com
Sun Feb 5 20:56:49 EST 2012


Stefan wrote:
> I tried to perform an automated import of landsat imagery
> using the python
> script (found here:
> http://grass.osgeo.org/wiki/LANDSAT#Automated_data_import).
> 
> After starting the python-script, I get the following
> error-message:
> 
> 
> 
> The structure of the folder 'LS5_125_049_20050504' is as
> follows:
> 
> 
> Anybody has an idea, why the py-script cannot define the
> 'band' name?
> 
> Stefan
> 
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/landsat-import-with-python-script-tp4366043p4366043.html
> Sent from the Grass - Users mailing list archive at
> Nabble.com.

weird, nabble seems to have removed the attachments.

anyway, here they are from the nabble site:
> :~ ./import_landsat.py LS5_125_049_20050504/
> Importing L5125049_04920050504_B70.TIF -> B70 at LS5_125_049_20050504/...
> Traceback (most recent call last):
>   File "./import_landsat.py", line 87, in <module>
>     main()
>   File "./import_landsat.py", line 84, in main
>     import_tifs(sys.argv[1])
>   File "./import_landsat.py", line 47, in import_tifs
>     title = 'band %d' % band)
> NameError: global name 'band' is not defined


the "band" variable was never set in the script. it's a bug
on the wiki page.

I guess you need to change:
        kanal = int(name[-2])
to:
        band = int(name[-2])

in the code.


Hamish


More information about the grass-user mailing list