-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b0352e
commit 2362237
Showing
5 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,3 +133,6 @@ dmypy.json | |
|
||
# VSCode | ||
/.vscode | ||
|
||
# project | ||
docs/notebooks/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
S1_SETAP_2.1.0_2023-03-10_ETAD_IW.tar.gz sha256:ca7042371f72081ff35e9b511fc0aee3155dcbe3383aaefb49b50d75a098e26c | ||
S1_SETAP_2.1.0_2023-03-10_ETAD_SM.tar.gz sha256:50cc3080038aa438d03801513a5c6182ee17df2e0381fb7a2195687800941af9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Utility functiond for unittesting.""" | ||
|
||
import shutil | ||
import pathlib | ||
|
||
import pooch | ||
|
||
BASEURL = "https://sentiwiki.copernicus.eu/__attachments/1673968" | ||
# BASEURL = "file:///home/antonio/projects/esa/s1-etad/_local_test_data_repo" | ||
DATADIR = pathlib.Path(__file__).parent / "data" | ||
REGISTRY = DATADIR.joinpath("registry.txt") | ||
|
||
|
||
datarepo = pooch.create( | ||
path=DATADIR, | ||
base_url=BASEURL, | ||
# retry_if_failed=3, | ||
# version="0.5" | ||
registry=None, | ||
env="S1ETAD_TEST_DATA_DIR", | ||
) | ||
datarepo.load_registry(REGISTRY) | ||
|
||
|
||
def download_all(datarepo: pooch.Pooch = datarepo): | ||
for item in datarepo.registry_files: | ||
datarepo.fetch( | ||
item, | ||
processor=pooch.Untar(extract_dir=""), | ||
progressbar=True, | ||
) | ||
|
||
|
||
def clean_cache(datarepo: pooch.Pooch = datarepo): | ||
for item in datarepo.path.iterdir(): | ||
if item.match("S1?_??_ETA_*.SAFE"): | ||
shutil.rmtree(item) | ||
|
||
for item in datarepo.registry_files: | ||
datarepo.path.joinpath(item).unlink(missing_ok=True) |