Skip to content

eo_tools.S2

make_s2_color(input_dir, name='RGB')

Make a color representation of Sentinel-2 images by combining some bands.

Parameters:

Name Type Description Default
input_dir str

input directory containing the GeoTiff bands

required
name str

Name of the pre-defined color representation. Possible choices are 'RGB', 'CIR', 'SWIR', 'agri', 'geol', 'bathy'. Defaults to "RGB".

'RGB'

Raises:

Type Description
ValueError

description

process_s2_tiles(paths, bands=['B4', 'B3', 'B2'], shp=None, aoi_name=None, output_dir='/tmp', force_create=False)

Merge Sentinel-2 tiles by grouping them by data take ID. Writes bands as individual COG (Cloud Optimized GeoTIFF) files in a sub-folder.

Parameters:

Name Type Description Default
paths str

List of paths pointing to Sentinel-2 zipped products like e.g. EODAG download outputs.

required
bands list

list of bands to process. A single string (e.g. "B11") is also valid, as well as "all" to merge all bands. Defaults to ["B4", "B3", "B2"].

['B4', 'B3', 'B2']
shp shapely geometry

If shp is provided, the outputs will be cropped to the geometry. Defaults to None.

None
aoi_name str

adds a suffix to the subfolder name. Useful when the same products are cropped with different geometries, or simply to add a short description of the subfolder content. Defaults to None.

None
output_dir str

path where the subfolder will be created. Defaults to "/tmp".

'/tmp'
force_create bool

force creating bands that already exist on disk. Defaults to False.

False

s2_band_info()

Returns a pandas dataframe with information about Sentinel-2 bands.