GRASS logo


i.sentinel.import - Imports Sentinel satellite data downloaded from Copernicus Open Access Hub using


imagery, satellite, Sentinel, import


i.sentinel.import --help
i.sentinel.import [-rlocnpj] input=name [unzip_dir=name] [pattern=string] [pattern_file=string] [extent=string] [memory=integer] [register_output=name] [metadata=name] [--overwrite] [--help] [--verbose] [--quiet] [--ui]


Reproject raster data using r.import if needed
Link raster data instead of importing
Override projection check (use current location's projection)
Import cloud masks as vector maps
Do not unzip SAFE-files if they are already extracted
Print raster data to be imported and exit
Write meta data json for each band to LOCATION/MAPSET/json folder
Allow output files to overwrite existing files
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


input=name [required]
Name of input directory with downloaded Sentinel data
Name of directory into which Sentinel zip-files are extracted (default=input)
Band name pattern to import
File name pattern to import
Output raster map extent
Options: input, region
Default: input
input: extent of input map
region: extent of current region
Maximum memory to be used (in MB)
Cache size for raster rows
Default: 300
Name for output file to use with t.register
Name of directory into which Sentinel metadata json dumps are saved

Table of contents


The i.sentinel.import module allows importing Copernicus Sentinel products downloaded by the module.

By default i.sentinel.import imports all Sentinel scene files found in the input directory. The number of scene files can be optionally reduced by the pattern_file option. In this option, a regular expression for filtering the file names should be given, e.g. "MSIL2A.*T32VNR_2019" for importing only level 2A products for tile T32VNR from 2019.

By default i.sentinel.import imports the full scene. Optionally, the import can be reduced to the computational region extent with extent=region.

Note that in the case that spatial reference system of input data differs from GRASS GIS location, the input data need to be reprojected with r.import. To speed up this process, a higher than default value can be specified for the memory option.

In order to ignore insignificant mismatch of the spatial reference systems, the projection check can be suppressed with the -o flag.

Optionally input data can be linked by r.external when -l is given. Note that linking data requires that Sentinel input data and GRASS location have the same spatial reference system (e.g., the same UTM zone).

The number of imported Sentinel bands can be optionally reduced by the pattern option. Below an overview of the Sentinel-2 MSI band spatial resolutions:

Spatial resolution [m] S2 Bands
10 B02, B03, B04, B08
20 B05, B06, B07, B8A, B11, B12
60 B01, B09, B10

Level 2A (L2A) products for Sentinel-2 come with a scene classification (SCL layer) at 20m and 60m resolution, that e.g. can be used for masking clouds and snow and is also imported by default.

For each imported band both scene and band specific metadata on geometric conditions as well as quality indicators are written into the map history ( In addition, the scene name is stored as source1 and the imported or linked file name as source2. Also, sensing time is written into the timestamp of the map. After import, the metadata can be retrieved with -e as shown below.



If -c flag is given, than also cloud mask file is imported as vector map if available. The name of created vector map is determined from input Sentinel product.

By register_file option i.sentinel.import allows creating a file which can be used to register imported imagery data into space-time raster dateset (STRDS) by t.register. Note that currently a register file can be created only for Sentinel-2 data. See example below. Metadata import By using the -j flag the band metadata are additionally stored in JSON format (in the current mapset under cell_misc). These metadata JSON files are supported by i.sentinel.mask.


List Sentinel bands

At first, print 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.sentinel.import -p input=data

data/S2B_MSIL1C_20180216T102059_N0206_R065_T32UPB_20180216T140508.SAFE/GRANULE/.../T32UPB_20180216T102059_B04.jp2 1 (EPSG: 32632)
data/S2B_MSIL1C_20180216T102059_N0206_R065_T32UPB_20180216T140508.SAFE/GRANULE/.../T32UPB_20180216T102059_B07.jp2 1 (EPSG: 32632)
data/S2B_MSIL1C_20180216T102059_N0206_R065_T32UPB_20180216T140508.SAFE/GRANULE/.../T32UPB_20180216T102059_B11.jp2 1 (EPSG: 32632)

Import Sentinel data

Import all Sentinel bands found in data directory and store metadata as JSON files within the GRASS GIS database directory:
i.sentinel.import -j input=data

Limit import to only to 4th and 8th bands:

i.sentinel.import -j input=data pattern='B0(4|8)'

Limit import to all bands with 10m resolution (excluding AOT, WVP, ... bands):

i.sentinel.import -j input=data pattern='B0(2|3|4|8)_10m'

Limit import to only selected bands with 10m and 20m resolution (excluding AOT, WVP, ... bands):

i.sentinel.import -j input=data pattern='B(02_1|03_1|04_1|08_1|11_2)0m'

Limit import to all bands with 10m and 20m resolution (excluding AOT, WVP, ... bands):

i.sentinel.import -j input=data pattern='_B((0[2348]_1)|(0[567]|8A|11|12)_2)0m'

Link data and import also cloud mask file:

i.sentinel.import -l -c -j input=data

Fig: Band 4 with imported cloud mask

Link data from specific UTM zone while ignoring projection check

i.sentinel.import -l -o -j input=data pattern_file="_T32"

Limit import to only bands 3 and 4 from level 2A products for tile T32VNR in 2019

i.sentinel.import -j input=data pattern_file="MSIL2A.*T32VNR_2019" pattern='B(03|04)'

Limit import to only bands 3 and 4 from level 2A products for tile T32VNR in 2019, unzip to directory "safefiles_dir":

i.sentinel.import -j input=data unzip_dir=safefiles_dir pattern_file="MSIL2A.*T32VNR_2019" pattern='B(03|04)'

Register imported Sentinel data into STRDS

i.sentinel.import -j input=data register_output=t_register.txt

# register imported data into existing STRDS
t.register input=sentinel_ds file=t_register.txt
A register file typically contains two columns: imported raster map name and timestamp separated by |. In the case of current development version of GRASS which supports band references concept (see g.bands module for details) a register file is extended by a third column containg band reference information, see the examples below.
# register file produced by stable GRASS GIS 7.8 version
T33UVR_20181205T101401_B05|2018-12-05 10:16:43.275000
T33UVR_20181205T101401_B03|2018-12-05 10:16:43.275000
T33UVR_20181205T101401_B06|2018-12-05 10:16:43.275000
# register file produced by development GRASS GIS 7.9 version
T33UVR_20181205T101401_B05|2018-12-05 10:16:43.275000|S2_5
T33UVR_20181205T101401_B03|2018-12-05 10:16:43.275000|S2_3
T33UVR_20181205T101401_B06|2018-12-05 10:16:43.275000|S2_6


Overview of i.sentinel toolset, i.sentinel.preproc, i.sentinel.mask, r.import, r.external, v.import

See also GRASS GIS Workshop in Jena for usage examples.


Martin Landa, GeoForAll Lab, CTU in Prague, Czech Republic with support of OpenGeoLabs company


Available at: i.sentinel.import source code (history)

Main index | Imagery index | Topics index | Keywords index | Graphical index | Full index

© 2003-2020 GRASS Development Team, GRASS GIS 7.8.4dev Reference Manual