Skip to content

Module fordead.cli.cli_theia_preprocess

Module with the theia preprocess function and a corresponding command line.

Functions

theia_preprocess

def theia_preprocess(
    zipped_directory,
    unzipped_directory,
    tiles,
    login_theia=None,
    password_theia=None,
    level='LEVEL2A',
    start_date='2015-06-23',
    end_date=None,
    lim_perc_cloud=50,
    bands=['B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B8A', 'B11', 'B12', 'CLMR2'],
    correction_type='FRE',
    empty_zip=False,
    retry=10,
    wait=300,
    search_timeout=10
)
Download Sentinel-2 zip files from THEIA portal, 
extract band files and eventually merge tile+date duplicates.

Scenes can be filtered on cloud coverage, and zip files
can be emptied as a way to save storage space while avoiding
downloading the same data twice.
Finally, if two Sentinel-2 directories come from the same acquisition date,
they are merged by replacing sequentially the valid pixels of each duplicate.

Parameters
----------
zipped_directory : str
    Path of the directory with zipped theia data.
unzipped_directory : str
    Path of the output directory.
tiles : list of str
    Name of the tiles to be downloaded (format : T31UFQ)
login_theia : str
    Login of your theia account.
password_theia : str
    Password of your theia account.
level : str
    Product level for reflectance products, can be 'LEVEL1C', 'LEVEL2A' or 'LEVEL3A'
start_date : str, optional
    start date, fmt('2015-12-22'). The default is "2015-06-23".
end_date : str, optional
    end date, fmt('2015-12-22'). The default is None.
lim_perc_cloud : int, optional
    Maximum cloudiness in SENTINEL dates downloaded (%). The default is 50.
bands : list of str
    List of bands to extracted (B2, B3, B4, B5, B6, B7, B8, B8A, B11, B12, as well as CLMR2, CLMR2, EDGR1, EDGR2, SATR1, SATR2 for LEVEL2A data, and DTS1, DTS2, FLG1, FLG2, WGT1, WGT2 for LEVEL3A). The default is ["B2", "B3", "B4", "B5", "B6", "B7", "B8", "B8A", "B11", "B12", "CLMR2"].
correction_type : str
    Chosen correction type (SRE or FRE for LEVEL2A data, FRC for LEVEL3A)
empty_zip : bool, optional
    If True, the zip files are emptied as a way to save space. The default is False.
retry : int, optional
    Number of retries if download fails. The default is 10.
wait : int, optional
    Wait time between retries in seconds. The default is 300.
search_timeout : int, optional
    Search timeout in seconds. The default is 10.

Returns
-------
None.