SENTINEL2 -- Sentinel-2 Products

The SENTINEL2 driver will be used if the main metadata .xml file at the
root of a SENTINEL2 data product is opened (whose name is typically
S2A_OPER_MTD_SAFL1C_....xml). It can also accept directly .zip files downloaded
from the Sentinels Scientific Data Hub

To be able to read the imagery, GDAL must be configured with at least one of
the JPEG2000 capable drivers.

SENTINEL-2 data are acquired on 13 spectral bands in the
visible and near-infrared (VNIR) and Short-wavelength infrared (SWIR) spectrum,
as show in the below table:

Band name

Resolution (m)

Central wavelength (nm)

Band width (nm)

Purpose

B01

60

443

20

Aerosol detection

B02

10

490

65

Blue

B03

10

560

35

Green

B04

10

665

30

Red

B05

20

705

15

Vegetation classification

B06

20

740

15

Vegetation classification

B07

20

783

20

Vegetation classification

B08

10

842

115

Near infrared

B08A

20

865

20

Vegetation classification

B09

60

945

20

Water vapour

B10

60

1375

30

Cirrus

B11

20

1610

90

Snow / ice / cloud discrimination

B12

20

2190

180

Snow / ice / cloud discrimination

Level-1B

Level-1B products are composed of several "granules" of ~ 25 km across-track x
~ 23km along-track, in sensor geometry (i.e. non ortho-rectified).
Each granule correspond to the imagery captured
by one of the 12 detectors accros-track (for a total 290 km swath width).
The imagery of each band is put in a separate JPEG2000 file.

Level-1B products are aimed at advanced users.

When opening the main
metadata .xml file, the driver will typically expose N * 3 sub-datasets, where N
is the number of granules composing the user product, and 3 corresponds to the
number of spatial resolutions. There's one for the 4
10m bands, one for the 6 20m bands and one for the 3 60m bands. Caution: the
number of such subdatasets can be typically of several hundreds or more.

It is also possible to open the metadata .xml of a given granule, in which
case 3 subdatasets will be reported for each of the 3 spatial resolutions.

When opening a subdataset, the georeferencing is made of 5 ground control points
for the 4 corner of the images and the center of image.

Level-1C

Level-1C products are organized in ortho-rectified tiles of 100 km x 100 km
in UTM WGS84 projections. The imagery of each band is put in a separate JPEG2000 file.

When opening the main
metadata .xml file, the driver will typically expose 4 sub-datasets:

one for the 4 10m bands,

one for the 6 20m bands,

one for the 3 60m bands and,

one for a preview of the R,G,B bands at a 320m resolution

All tiles of same resolution and projection are mosaiced together.
If a product spans over several UTM zones,
they will be exposed as separate subdatasets.

It is also possible to open the metadata .xml file of each tile (only for
original L1C encoding, not supported on "Safe Compact" encoding), in which case
the driver will typically expose the 4 above mentioned types of sub-datasets.

Level-2A

Similarly to Level-1C, Level-2A products are organized in ortho-rectified
tiles of 100 km x 100 km in UTM WGS84 projections. The imagery of each band is
put in a separate JPEG2000 file.
The values are Bottom-Of-Atmosphere (BOA) reflectances. L2A specific bands are
also computed:

AOT: Aerosol Optical Thickness map (at 550nm)

CLD: Raster mask values range from 0 for high confidence clear sky to 100
for high confidence cloudy

SCL: Scene Classification. The meaning of the values is indicated in the
Category Names of the band.

SNW: Raster mask values range from 0 for high confidence NO snow/ice to 100
for high confidence snow/ice

WVP: Scene-average Water Vapour map

When opening the main
metadata .xml file, the driver will typically expose 4 sub-datasets:

All tiles of same resolution and projection are mosaiced together.
If a product spans over several UTM zones,
they will be exposed as separate subdatasets.

Metadata

Metadata of the main metadata .xml file is available in the general metadata
domain. The whole XML file is also accessible through the xml:SENTINEL2 metadata
domain.

Subdatasets are based on the VRT format, so the definition of this VRT can
be obtained by querying the xml:VRT metadata domain.

Performance issues for L1C and L2A

Due to the way Sentinel-2 products are structured, in particular because of
the number of JPEG2000 files involved, zoom-out operations can be very slow for
products made of many tiles. For interactive
display, it can be useful to generate overviews (can be a slow operation by
itself). This can be done with the gdaladdo utility on the subdataset name.
The overview file is created next to the main metadata .xml file, with the same
name, but prefixed with _XX_EPSG_YYYYY.tif.ovr where XX=10m,20m,60m or PREVIEW
and YYYYY is the EPSG code.

Trick: if the content of the zoom-out preview is not important for the use case,
blank overviews can be created instantaneously
by using the NONE resampling method ('-r none' as gdaladdo switch).

When converting a subdataset to another format like tiled GeoTIFF, if using
the JP2OpenJPEG driver, the recommended minimum value for the GDAL_CACHEMAX
configuration option is (subdataset_width * 2048 * 2 ) / 10000000 if generating a
INTERLEAVE=BAND GeoTIFF, or that value multiplied by the number of bands for
the default INTERLEAVE=PIXEL configuration.
The current versions of the OpenJPEG libraries can also consume a lot of memory
to decode a JPEG2000 tile (up to 600MB), so you might want to specify the
GDAL_NUM_THREADS configuration option to a reasonable number of threads if you
are short of memory (the default value is the total number of virtual CPUs).

Open options

The driver can be passed the following open options:

ALPHA=YES/NO: whether to expose an alpha band. Defaults to NO. If set,
an extra band is added after the Sentinel2 bands with an alpha channel. Its value
are:

0 on areas with no tiles, or when the tile data is set to the NODATA or SATURATED
special values,

4095 on areas with valid data.

Note: above open options can also be specified as configuration options, by
prefixing the open option name with SENTINEL2_ (e.g. SENTINEL2_ALPHA).