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,
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',
search_timeout=10,
upgrade=False,
keep_zip=False,
dry_run=True,
retry=10,
wait=5
)
Download Sentinel-2 zip files from GEODES (LEVEL2A) or THEIA (LEVEL3A) portal,
extract band files and eventually merge tile+date duplicates.
Scenes can be filtered on cloud coverage. After extracting zip files, they
are emptied as a way to save storage space while avoiding downloading the
same data twice. It also serve to identify the tile+date duplicates that
have been merged. So do not remove the empty zips.
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)
level : str
Level can be '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)
search_timeout : int, optional
Search timeout in seconds. The default is 10.
upgrade : bool, optional
Upgrade product version. The default is False.
keep_zip : bool, optional
Keep zip files. The default is False.
dry_run : bool, optional
If True, no data is downloaded. The default is True.
retry : int, optional
Number of times to retry a failed download. The default is 10.
wait : int, optional
On a failed download, the script waits wait*trials minutes before retrying
until the maximum number of retries is reached. The default is 5.
Returns
-------
None.
Notes
-----
See the downloading section in user guides for GEODES authentication details.