i.landsat.import
Imports Landsat satellite data downloaded using i.landsat.download.
i.landsat.import [-rlop] input=name [unzip_dir=name] [pattern=string] [pattern_file=string] [extent=string] [resample=string] [memory=integer] [register_output=name] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
i.landsat.import input=name
grass.script.run_command("i.landsat.import", input, unzip_dir=None, pattern=None, pattern_file=None, extent="input", resample="nearest", memory=300, register_output=None, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("i.landsat.import", input="name")
Parameters
input=name [required]
Name of input directory with downloaded Landsat data
unzip_dir=name
Name of directory into which Landsat zip-files are extracted (default=input)
pattern=string
Band name pattern to import
pattern_file=string
File name pattern to import
extent=string
Output raster map extent
Allowed values: input, region
Default: input
input: extent of input map
region: extent of current region
resample=string
Resampling method to use for reprojection
Allowed values: nearest, bilinear, bicubic, lanczos, bilinear_f, bicubic_f, lanczos_f
Default: nearest
nearest: nearest neighbor
bilinear: bilinear interpolation
bicubic: bicubic interpolation
lanczos: lanczos filter
bilinear_f: bilinear interpolation with fallback
bicubic_f: bicubic interpolation with fallback
lanczos_f: lanczos filter with fallback
memory=integer
Maximum memory to be used (in MB)
Cache size for raster rows
Default: 300
register_output=name
Name for output file to use with t.register
-r
Reproject raster data using r.import if needed
-l
Link raster data instead of importing
-o
Override projection check (use current location's projection)
-p
Print raster data to be imported and exit
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
input : str, required
Name of input directory with downloaded Landsat data
Used as: input, dir, name
unzip_dir : str, optional
Name of directory into which Landsat zip-files are extracted (default=input)
Used as: input, dir, name
pattern : str, optional
Band name pattern to import
pattern_file : str, optional
File name pattern to import
extent : str, optional
Output raster map extent
Allowed values: input, region
input: extent of input map
region: extent of current region
Default: input
resample : str, optional
Resampling method to use for reprojection
Allowed values: nearest, bilinear, bicubic, lanczos, bilinear_f, bicubic_f, lanczos_f
nearest: nearest neighbor
bilinear: bilinear interpolation
bicubic: bicubic interpolation
lanczos: lanczos filter
bilinear_f: bilinear interpolation with fallback
bicubic_f: bicubic interpolation with fallback
lanczos_f: lanczos filter with fallback
Default: nearest
memory : int, optional
Maximum memory to be used (in MB)
Cache size for raster rows
Default: 300
register_output : str, optional
Name for output file to use with t.register
Used as: output, file, name
flags : str, optional
Allowed values: r, l, o, p
r
Reproject raster data using r.import if needed
l
Link raster data instead of importing
o
Override projection check (use current location's projection)
p
Print raster data to be imported and exit
overwrite: bool, optional
Allow output files to overwrite existing files
Default: False
verbose: bool, optional
Verbose module output
Default: False
quiet: bool, optional
Quiet module output
Default: False
superquiet: bool, optional
Very quiet module output
Default: False
DESCRIPTION
The i.landsat.import module allows importing Landsat 5, 7 and 8 products downloaded by the i.landsat.download module.
By default i.landsat.import imports all Landsat bands within the scene files found in the input directory. The number of scene files can be optionally reduced with the pattern_file option. In this option, a regular expression for filtering the file names can be given, e.g. '229083' for importing only scenes from path 229 and row 083.
By default i.landsat.import imports the full scene. Optionally, the import can be reduced to the computational region extent with extent=region.
Note that in case that the spatial reference system of the input data differs from that of the GRASS GIS target location, the input data will be reprojected internally by means of r.import. To speed up this process, a higher than default value can be specified for the memory option.
If the user wants to ignore an insignificant mismatch in the spatial reference system, the projection check can be suppressed with the -o flag and data will be imported directly.
Alternatively, input data can be linked by means of r.external using -l flag. Note that linking data requires that Landsat input data and GRASS location have the same spatial reference system (e.g., the same UTM zone). Take into account that USGS provides all Landsat products in UTM north zones whether they belong to North or South Hemisphere.
The number of Landsat bands to be imported can be optionally reduced by the pattern option. Below an overview of Landsat 5 TM, 7 ETM and 8 OLI band's spatial resolution:
Spatial resolution [m] | L5 Bands | L7 Bands | L8 Bands |
---|---|---|---|
15 | -- | B8 | B8 |
30 | B1, B2, B3, B4, B5, B7 | B1, B2, B3, B4, B5, B7 | B1, B2, B3, B4, B5, B6, B7, B9 |
60 | -- | B6 | -- |
100 | -- | -- | B10, B11 |
120 | B6 | -- | -- |
Note that while the original resolution of band 6 in Landsat 5 TM and Landsat 7 ETM is 120 and 60 m respectively, they are provided with a resampled resolution of 30 m. For further details about bands wavelength and scene size, visit the band designations page at USGS website.
The file naming convention for Landsat scenes is found here.
With the register_output option i.landsat.import allows to create
a text file that can be used to register imported imagery data into a
space-time raster dateset (STRDS) by means of
t.register.
A register file typically contains 2 or 3 columns with the map name and
start time or the map name plus start and end time in the case of
interval time type. Landsat data is considered to be of instance time
type, i.e., we only have one point in time. Hence, the output register
file will contain the map name and start time separated by |
when
using GRASS GIS stable version. In the case of GRASS GIS development
version which supports the band reference concept (see
i.band.library
module for details), the output register file is extended by a third
column containing the band reference information, see the examples
below.
EXAMPLES
List Landsat bands to import
At first, print the list of raster files to be imported by -p. For each file also projection match with current location is printed including detected input data EPSG code:
i.landsat.import -p input=data
Import Landsat data
Limit import to only 4th and 5th bands:
i.landsat.import input=data pattern='B(4|5)'
Limit import to all bands with 30m resolution:
i.landsat.import input=data pattern='B(1|2|3|4|5|6|7|9)'
Link Landsat data:
i.landsat.import -l input=data
Link data from specific path and row while ignoring projection check
i.landsat.import -l -o input=data pattern_file='229083'
Limit import to bands 4 and 5 for path 229 and row 083 in 2019
i.landsat.import input=data pattern_file='229083_2019' pattern='B(4|5)'
Limit import to optical, NIR, thermal and QA_PIXEL using a regular expression (Landsat-8):
i.landsat.import input=data pattern='(B(2|3|4|5|6|7|8|10|11)|QA_PIXEL)'
Limit import to bands 4 and 5 for path 229 and row 083 in 2019 and get a txt file to use in t.register
i.landsat.import input=data pattern_file='229083_2019' pattern='B(4|5)' \
register_output=t_register.txt
# create a STRDS and register imported data
t.create output=landsat_ts title="Landsat 8 time series" \
description="Landsat 8 data, path-row 229-83, year 2020"
t.register input=landsat_ts file=t_register.txt
SEE ALSO
i.landsat.download, i.landsat.qa, i.landsat.toar, i.landsat8.swlst, r.import, r.external
AUTHOR
Veronica Andreo, CONICET, Argentina.
SOURCE CODE
Available at: i.landsat.import source code
(history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819