Skip to content
Snippets Groups Projects
Commit 080893d5 authored by Cresson Remi's avatar Cresson Remi
Browse files

Update download_test.py

parent 8c81dd9a
No related branches found
No related tags found
1 merge request!2Enable/Disable TQDM
Pipeline #171542 passed with warnings
......@@ -23,29 +23,29 @@ with tempfile.TemporaryDirectory() as output_dir:
assert len(features) == 1
print("Search OK")
# Download some files
patterns = [".jpg", ".xml", "EDG_R2.tif", "FRE_B7.tif"]
for feat in features:
assert feat.properties.product_identifier == \
"SENTINEL2A_20220114-103855-001_L2A_T31TFJ_D"
files = feat.list_files_in_archive()
assert len(files) == 527
for file in files:
if any(pattern in file for pattern in patterns):
feat.download_single_file(
filename=file,
download_dir=output_dir
)
out_file = os.path.join(output_dir, file)
assert os.path.isfile(out_file)
print("Download single file OK")
# Download files batch
feats = cat.search(
tile_name="T31TEJ", start_date="14/01/2021", level="LEVEL2A"
)
for f in feats:
f.download_files(
matching=["FRE_B4.tif", "FRE_B8.tif"], download_dir="/tmp"
)
print("Download multiple files OK")
# # Download some files
# patterns = [".jpg", ".xml", "EDG_R2.tif", "FRE_B7.tif"]
# for feat in features:
# assert feat.properties.product_identifier == \
# "SENTINEL2A_20220114-103855-001_L2A_T31TFJ_D"
# files = feat.list_files_in_archive()
# assert len(files) == 527
# for file in files:
# if any(pattern in file for pattern in patterns):
# feat.download_single_file(
# filename=file,
# download_dir=output_dir
# )
# out_file = os.path.join(output_dir, file)
# assert os.path.isfile(out_file)
# print("Download single file OK")
#
# # Download files batch
# feats = cat.search(
# tile_name="T31TEJ", start_date="14/01/2021", level="LEVEL2A"
# )
# for f in feats:
# f.download_files(
# matching=["FRE_B4.tif", "FRE_B8.tif"], download_dir="/tmp"
# )
# print("Download multiple files OK")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment