satpy.readers.msi_safe module

SAFE MSI L1C reader.

The MSI data has a special value for saturated pixels. By default, these pixels are set to np.inf, but for some applications it might be desirable to have these pixels left untouched. For this case, the mask_saturated flag is available in the reader, and can be toggled with reader_kwargs upon Scene creation:

scene = satpy.Scene(filenames,
                    reader_kwargs={'mask_saturated': False})

L1B format description for the files read here:

class satpy.readers.msi_safe.SAFEMSIL1C(filename, filename_info, filetype_info, mda, tile_mda, mask_saturated=True)[source]

Bases: BaseFileHandler

File handler for SAFE MSI files (jp2).

Initialize the reader.

property end_time

Get the end time.


Get the area def.

get_dataset(key, info)[source]

Load a dataset.

property start_time

Get the start time.

class satpy.readers.msi_safe.SAFEMSIMDXML(filename, filename_info, filetype_info, mask_saturated=True)[source]

Bases: SAFEMSIXMLMetadata

File handle for sentinel 2 safe XML generic metadata.

Init the reader.

property band_indices

Get the band indices from the metadata.


Get the band offset for band.

property band_offsets

Get the band offsets from the metadata.

calibrate_to_radiances(data, band_name)[source]

Calibrate data to radiance using the radiometric information for the metadata.

calibrate_to_reflectances(data, band_name)[source]

Calibrate data using the radiometric information for the metadata.

property no_data

Get the nodata value from the metadata.


Get the physical gain for a given band_name.

property physical_gains

Get the physical gains dictionary.

property saturated

Get the saturated value from the metadata.

property special_values

Get the special values from the metadata.

class satpy.readers.msi_safe.SAFEMSITileMDXML(filename, filename_info, filetype_info, mask_saturated=True)[source]

Bases: SAFEMSIXMLMetadata

File handle for sentinel 2 safe XML tile metadata.

Init the reader.

static _do_interp(minterp, xcoord, ycoord)[source]
_get_coarse_dataset(key, info)[source]

Get the coarse dataset refered to by key from the XML data.

_get_satellite_angles(angles, info)[source]
_get_solar_angles(angles, info)[source]
static _get_values_from_tag(xml_tree, xml_tag)[source]

Get the area definition of the dataset.

get_dataset(key, info)[source]

Get the dataset referred to by key.

interpolate_angles(angles, resolution)[source]

Interpolate the angles.

property projection

Get the geographic projection.

class satpy.readers.msi_safe.SAFEMSIXMLMetadata(filename, filename_info, filetype_info, mask_saturated=True)[source]

Bases: BaseFileHandler

Base class for SAFE MSI XML metadata filehandlers.

Init the reader.

property end_time

Get end time.

property start_time

Get start time.


Fill gaps at edges of swath.