[GRASS-dev] Copying Landsat MTL file(s) inside the cell_misc directory -- Python scripting

Nikos Alexandris nik at nikosalexandris.net
Sat May 11 03:36:57 PDT 2013


Dear list,

whose creation is the the import_landsat.py script featured in
<http://grasswiki.osgeo.org/wiki/LANDSAT#Automated_data_import>?

I would like to expand it a bit in copying the respective metadata (*MTL.txt)
files over to the (respective) "cell_misc" directory?  I guess that using the
"shutil" is the way to go, like:

# in the beginning
import shutil

# later on... but where?
env=grass.gisenv()
shutil.copy ( metafile, env['GISDBASE'] + '/' + env['LOCATION_NAME'] + '/' +
env['MAPSET'] + '/cell_misc')

Is that correct?  It seems it works interactively. I am ignorant, however,
about where to insert the above instructions. I wrongly tried within the
"import_tifs()" function, inside the 1st for loop, right after the
creation of
a Mapset of interest.

Thanks for any hints, Nikos



More information about the grass-dev mailing list