eumdac-store 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- eumdac_store-0.4.0/.github/workflows/ci.yml +39 -0
- eumdac_store-0.4.0/.gitignore +16 -0
- eumdac_store-0.4.0/AUTHORS.rst +5 -0
- eumdac_store-0.4.0/LICENSE.txt +21 -0
- eumdac_store-0.4.0/PKG-INFO +147 -0
- eumdac_store-0.4.0/README.md +122 -0
- eumdac_store-0.4.0/examples/ascat_szf.yaml +30 -0
- eumdac_store-0.4.0/examples/iasi_l1c.yaml +19 -0
- eumdac_store-0.4.0/examples/metop_nto.yaml +20 -0
- eumdac_store-0.4.0/examples/msg_hrsevir.yaml +22 -0
- eumdac_store-0.4.0/examples/mtg_fci_l1c.yaml +19 -0
- eumdac_store-0.4.0/examples/sentinel3_olci_l1b.yaml +21 -0
- eumdac_store-0.4.0/pyproject.toml +63 -0
- eumdac_store-0.4.0/src/eumdac_store/__init__.py +14 -0
- eumdac_store-0.4.0/src/eumdac_store/_version.py +24 -0
- eumdac_store-0.4.0/src/eumdac_store/catalog.py +137 -0
- eumdac_store-0.4.0/src/eumdac_store/cli.py +187 -0
- eumdac_store-0.4.0/src/eumdac_store/config.py +106 -0
- eumdac_store-0.4.0/src/eumdac_store/fetcher.py +341 -0
- eumdac_store-0.4.0/src/eumdac_store/integrity.py +120 -0
- eumdac_store-0.4.0/src/eumdac_store/service.py +136 -0
- eumdac_store-0.4.0/src/eumdac_store/storage.py +55 -0
- eumdac_store-0.4.0/tests/conftest.py +108 -0
- eumdac_store-0.4.0/tests/test_catalog.py +123 -0
- eumdac_store-0.4.0/tests/test_config.py +83 -0
- eumdac_store-0.4.0/tests/test_examples.py +78 -0
- eumdac_store-0.4.0/tests/test_fetcher.py +292 -0
- eumdac_store-0.4.0/tests/test_integrity.py +77 -0
- eumdac_store-0.4.0/tests/test_service.py +88 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Tests on every push and pull request; on a version tag (vX.Y.Z), build and
|
|
2
|
+
# publish to PyPI with trusted publishing (no token: PyPI trusts this
|
|
3
|
+
# workflow in the "pypi" environment of TUW-GEO/eumdac-store).
|
|
4
|
+
name: ci
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
tags: ["v*"]
|
|
10
|
+
pull_request:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python: ["3.12", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: astral-sh/setup-uv@v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python }}
|
|
23
|
+
- run: uv sync --dev --extra s3
|
|
24
|
+
- run: uv run pytest tests
|
|
25
|
+
|
|
26
|
+
publish:
|
|
27
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
28
|
+
needs: test
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
environment: pypi
|
|
31
|
+
permissions:
|
|
32
|
+
id-token: write
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
with:
|
|
36
|
+
fetch-depth: 0 # hatch-vcs reads the version from the tag
|
|
37
|
+
- uses: astral-sh/setup-uv@v6
|
|
38
|
+
- run: uv build
|
|
39
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TU Wien
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: eumdac-store
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Robust EUMDAC downloader with integrity validation, quarantine, and a ducats-backed catalog, to a directory or a bucket
|
|
5
|
+
Project-URL: Repository, https://github.com/TUW-GEO/eumdac-store
|
|
6
|
+
Author-email: TU Wien <remote.sensing@geo.tuwien.ac.at>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE.txt
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering
|
|
12
|
+
Requires-Python: >=3.12
|
|
13
|
+
Requires-Dist: ducats>=0.2
|
|
14
|
+
Requires-Dist: eumdac<5,>=4.0
|
|
15
|
+
Requires-Dist: pydantic-settings>=2.0
|
|
16
|
+
Requires-Dist: pydantic>=2.0
|
|
17
|
+
Requires-Dist: python-dotenv>=1.0
|
|
18
|
+
Requires-Dist: pyyaml>=6.0
|
|
19
|
+
Requires-Dist: requests>=2.31
|
|
20
|
+
Requires-Dist: urllib3>=2.0
|
|
21
|
+
Provides-Extra: s3
|
|
22
|
+
Requires-Dist: s3fs>=2024.6; extra == 's3'
|
|
23
|
+
Requires-Dist: universal-pathlib>=0.2; extra == 's3'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# eumdac-store
|
|
27
|
+
|
|
28
|
+
Robust EUMDAC downloader — Python API + CLI, to a directory or a bucket.
|
|
29
|
+
|
|
30
|
+
What it adds on top of plain `eumdac download`:
|
|
31
|
+
|
|
32
|
+
- **Rate-limit awareness** — parallel downloads clamped to EUMDAC's 10-connection ceiling.
|
|
33
|
+
- **Retries with backoff** — one budget shared across network errors and integrity failures.
|
|
34
|
+
- **Integrity validation** — each download checked against EUMDAC's size + ZIP magic before publishing. MD5 is skipped (EUMDAC publishes wrong MD5 metadata).
|
|
35
|
+
- **Atomic publish** — partials are unlinked on failure, so a reader never sees half-files.
|
|
36
|
+
- **Persistent-corruption quarantine** — a product that exhausts the retry budget gets a `.quarantine` sidecar (JSON `kind`: `missing` / `size` / `zip`) and is skipped until cooloff.
|
|
37
|
+
- **Skip what we already have** — a [ducats](https://github.com/TUW-GEO/ducats) catalog synced from the store (a directory or a bucket) decides presence, re-synced after each run.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install eumdac-store # a local directory as the store
|
|
43
|
+
pip install "eumdac-store[s3]" # also object storage (s3://…)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For development: `uv sync --extra s3`.
|
|
47
|
+
|
|
48
|
+
## CLI
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Download the last day, skipping what the catalog already has.
|
|
52
|
+
# Product wiring is required and comes from a config file — ASCAT SZF values ship in examples/ascat_szf.yaml:
|
|
53
|
+
eumdac-store download --config examples/ascat_szf.yaml --days 1 \
|
|
54
|
+
--download-root-dir /data/eumdac
|
|
55
|
+
|
|
56
|
+
# Explicit window:
|
|
57
|
+
eumdac-store download --config examples/ascat_szf.yaml \
|
|
58
|
+
--start 2026-01-01T00:00 --end 2026-01-02T00:00 ...
|
|
59
|
+
|
|
60
|
+
# Either bound is optional: --start alone fetches everything since then (up to
|
|
61
|
+
# now); --end alone fetches everything up to it (open lower bound).
|
|
62
|
+
# E.g. backfill the whole collection up to a date:
|
|
63
|
+
eumdac-store download --config examples/ascat_szf.yaml --end 2026-01-01T00:00 ...
|
|
64
|
+
|
|
65
|
+
# List without downloading:
|
|
66
|
+
eumdac-store list --config examples/ascat_szf.yaml --days 1 ...
|
|
67
|
+
|
|
68
|
+
# Re-sync the catalog from the store (no EUMDAC calls):
|
|
69
|
+
eumdac-store sync --config examples/ascat_szf.yaml ...
|
|
70
|
+
|
|
71
|
+
# Sync status + quarantine sidecar count:
|
|
72
|
+
eumdac-store status --config examples/ascat_szf.yaml ...
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Credentials: `EUMDAC_KEY` / `EUMDAC_SECRET` in the environment or `.env`, or EUMETSAT's own `credentials.json` (`{"consumer_key": …, "consumer_secret": …}`) placed at `$XDG_CONFIG_HOME/eumdac-store/credentials.json` (default `~/.config/eumdac-store/credentials.json`). Env vars win over the file. Config also via `$EUMDAC_STORE_CONFIG` or `EUMDAC_STORE_*` env vars; per-flag options win.
|
|
76
|
+
|
|
77
|
+
## Object storage (S3)
|
|
78
|
+
|
|
79
|
+
`download_root_dir` may be a URL instead of a directory; the local filesystem stays the default.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
uv sync --extra s3 # universal-pathlib + s3fs
|
|
83
|
+
eumdac-store download --config examples/ascat_szf.yaml --days 1 \
|
|
84
|
+
--download-root-dir s3://tuw-ascat-l1b/eumdac
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Credentials and endpoint come from the usual AWS sources (`AWS_PROFILE`, `AWS_SHARED_CREDENTIALS_FILE`, `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`, `AWS_ENDPOINT_URL`) or from `storage_options` (YAML, or `EUMDAC_STORE_STORAGE_OPTIONS` as JSON), passed to fsspec as is, e.g. `{"profile": "tuw-ascat-l1b", "endpoint_url": "https://objects.eodc.eu"}`.
|
|
88
|
+
|
|
89
|
+
What differs from a local root:
|
|
90
|
+
|
|
91
|
+
- **Publish** — the zip is downloaded and validated on local disk (a temp dir), then uploaded in one PUT; an object is only visible once its upload completes, so readers never see a half file.
|
|
92
|
+
- **Catalog** — local, as for every root (see Configuration); ducats's `glob()` lists the bucket through the same fsspec filesystem (registered with DuckDB), so presence still comes from what is really stored.
|
|
93
|
+
- **Quarantine** — sidecars are small objects next to the zips; their age is the object's LastModified (or the sidecar's own `quarantined_at`).
|
|
94
|
+
- **Retention** — set a lifecycle rule on the bucket; eumdac-store never deletes.
|
|
95
|
+
|
|
96
|
+
## Gaps
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
eumdac-store gaps --config examples/ascat_szf.yaml --days 2 # exit 4 if any
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Lists the store and reports breaks in each group's time chain (groups: the pattern's named groups other than `start`/`end`, e.g. `sat`; or `gap_group_cols`). Consecutive files chain when the next starts `gap_min_seconds`..`gap_max_seconds` after the last one ends (defaults 0..1 s, as SZF). `--start`/`--end` keep the gaps that begin in that window.
|
|
103
|
+
|
|
104
|
+
## Airflow
|
|
105
|
+
|
|
106
|
+
The fetch DAG that keeps a rolling archive filled (e.g. `s3://tuw-ascat-l1b/szf/`) lives in its own repository, **eumdac-fetch**. It installs this package from PyPI at a pinned version, so no image is needed.
|
|
107
|
+
|
|
108
|
+
## Python API
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from eumdac_store import EumdacStore, StoreConfig
|
|
112
|
+
|
|
113
|
+
store = EumdacStore(StoreConfig.from_yaml("examples/ascat_szf.yaml",
|
|
114
|
+
download_root_dir="/data/eumdac",
|
|
115
|
+
))
|
|
116
|
+
result = store.download(days=1) # or start=, end=, specific_dates=
|
|
117
|
+
print(result) # downloaded=… skipped_present=… skipped_quarantined=… failed=…
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Product fields are **required** (no defaults); pass them inline to `StoreConfig(...)` to skip the YAML.
|
|
121
|
+
|
|
122
|
+
## Configuration
|
|
123
|
+
|
|
124
|
+
| Field | Required | Default | Meaning |
|
|
125
|
+
|-------|----------|---------|---------|
|
|
126
|
+
| `collection_id` | **yes** | — | EUMDAC collection to search |
|
|
127
|
+
| `product_name` | **yes** | — | ducats catalog table name (must be a valid identifier)
|
|
128
|
+
| `filename_glob` | **yes** | — | Which files in `<product_name>/` the catalog globs |
|
|
129
|
+
| `filename_pattern` | **yes** | — | Regex for ducats's `RegexExtractor`; `(?P<start>...)` is required, `(?P<end>...)` optional (absent → `end_ts` NULL), other named groups become categorical columns |
|
|
130
|
+
| `download_root_dir` | **yes** | — | EUMDAC data root: `<product_name>/` per product lives here. A directory, or a URL such as `s3://bucket/prefix` (see Object storage) |
|
|
131
|
+
| `storage_options` | no | `{}` | fsspec options for a URL root |
|
|
132
|
+
| `catalog_file` | no | derived | DuckDB catalog path (see below) |
|
|
133
|
+
| `max_workers` | no | 10 | Parallel downloads (hard-clamped to 10) |
|
|
134
|
+
| `max_retries` | no | 3 | Retry budget per file |
|
|
135
|
+
| `quarantine_cooloff_hours` | no | 2.0 | How long a quarantine sidecar suppresses refetch |
|
|
136
|
+
|
|
137
|
+
`product_dir` is `<download_root_dir>/<product_name>/`. The catalog is a local cache of that listing, rebuilt from scratch on every sync, so it is kept out of the data: `catalog_path` is `catalog_file` if set, else `$XDG_CACHE_HOME/eumdac-store/<root>/catalog.duckdb` (`<root>` is the absolute directory without its leading `/`, or `bucket/prefix` for a URL). Losing it costs one sync. A catalog left at `<download_root_dir>/catalog.duckdb` by earlier versions is deleted after the first successful sync, so a copy of the root never carries a stale one.
|
|
138
|
+
|
|
139
|
+
Products under one `download_root_dir` share one catalog (one DuckDB file, one table per `product_name`).
|
|
140
|
+
|
|
141
|
+
Copy `examples/ascat_szf.yaml` for another product. A missing required field is a hard validation error.
|
|
142
|
+
|
|
143
|
+
## Tests
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
uv run pytest # no network — a fake EUMDAC DataStore backs every test
|
|
147
|
+
```
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# eumdac-store
|
|
2
|
+
|
|
3
|
+
Robust EUMDAC downloader — Python API + CLI, to a directory or a bucket.
|
|
4
|
+
|
|
5
|
+
What it adds on top of plain `eumdac download`:
|
|
6
|
+
|
|
7
|
+
- **Rate-limit awareness** — parallel downloads clamped to EUMDAC's 10-connection ceiling.
|
|
8
|
+
- **Retries with backoff** — one budget shared across network errors and integrity failures.
|
|
9
|
+
- **Integrity validation** — each download checked against EUMDAC's size + ZIP magic before publishing. MD5 is skipped (EUMDAC publishes wrong MD5 metadata).
|
|
10
|
+
- **Atomic publish** — partials are unlinked on failure, so a reader never sees half-files.
|
|
11
|
+
- **Persistent-corruption quarantine** — a product that exhausts the retry budget gets a `.quarantine` sidecar (JSON `kind`: `missing` / `size` / `zip`) and is skipped until cooloff.
|
|
12
|
+
- **Skip what we already have** — a [ducats](https://github.com/TUW-GEO/ducats) catalog synced from the store (a directory or a bucket) decides presence, re-synced after each run.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install eumdac-store # a local directory as the store
|
|
18
|
+
pip install "eumdac-store[s3]" # also object storage (s3://…)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For development: `uv sync --extra s3`.
|
|
22
|
+
|
|
23
|
+
## CLI
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Download the last day, skipping what the catalog already has.
|
|
27
|
+
# Product wiring is required and comes from a config file — ASCAT SZF values ship in examples/ascat_szf.yaml:
|
|
28
|
+
eumdac-store download --config examples/ascat_szf.yaml --days 1 \
|
|
29
|
+
--download-root-dir /data/eumdac
|
|
30
|
+
|
|
31
|
+
# Explicit window:
|
|
32
|
+
eumdac-store download --config examples/ascat_szf.yaml \
|
|
33
|
+
--start 2026-01-01T00:00 --end 2026-01-02T00:00 ...
|
|
34
|
+
|
|
35
|
+
# Either bound is optional: --start alone fetches everything since then (up to
|
|
36
|
+
# now); --end alone fetches everything up to it (open lower bound).
|
|
37
|
+
# E.g. backfill the whole collection up to a date:
|
|
38
|
+
eumdac-store download --config examples/ascat_szf.yaml --end 2026-01-01T00:00 ...
|
|
39
|
+
|
|
40
|
+
# List without downloading:
|
|
41
|
+
eumdac-store list --config examples/ascat_szf.yaml --days 1 ...
|
|
42
|
+
|
|
43
|
+
# Re-sync the catalog from the store (no EUMDAC calls):
|
|
44
|
+
eumdac-store sync --config examples/ascat_szf.yaml ...
|
|
45
|
+
|
|
46
|
+
# Sync status + quarantine sidecar count:
|
|
47
|
+
eumdac-store status --config examples/ascat_szf.yaml ...
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Credentials: `EUMDAC_KEY` / `EUMDAC_SECRET` in the environment or `.env`, or EUMETSAT's own `credentials.json` (`{"consumer_key": …, "consumer_secret": …}`) placed at `$XDG_CONFIG_HOME/eumdac-store/credentials.json` (default `~/.config/eumdac-store/credentials.json`). Env vars win over the file. Config also via `$EUMDAC_STORE_CONFIG` or `EUMDAC_STORE_*` env vars; per-flag options win.
|
|
51
|
+
|
|
52
|
+
## Object storage (S3)
|
|
53
|
+
|
|
54
|
+
`download_root_dir` may be a URL instead of a directory; the local filesystem stays the default.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
uv sync --extra s3 # universal-pathlib + s3fs
|
|
58
|
+
eumdac-store download --config examples/ascat_szf.yaml --days 1 \
|
|
59
|
+
--download-root-dir s3://tuw-ascat-l1b/eumdac
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Credentials and endpoint come from the usual AWS sources (`AWS_PROFILE`, `AWS_SHARED_CREDENTIALS_FILE`, `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`, `AWS_ENDPOINT_URL`) or from `storage_options` (YAML, or `EUMDAC_STORE_STORAGE_OPTIONS` as JSON), passed to fsspec as is, e.g. `{"profile": "tuw-ascat-l1b", "endpoint_url": "https://objects.eodc.eu"}`.
|
|
63
|
+
|
|
64
|
+
What differs from a local root:
|
|
65
|
+
|
|
66
|
+
- **Publish** — the zip is downloaded and validated on local disk (a temp dir), then uploaded in one PUT; an object is only visible once its upload completes, so readers never see a half file.
|
|
67
|
+
- **Catalog** — local, as for every root (see Configuration); ducats's `glob()` lists the bucket through the same fsspec filesystem (registered with DuckDB), so presence still comes from what is really stored.
|
|
68
|
+
- **Quarantine** — sidecars are small objects next to the zips; their age is the object's LastModified (or the sidecar's own `quarantined_at`).
|
|
69
|
+
- **Retention** — set a lifecycle rule on the bucket; eumdac-store never deletes.
|
|
70
|
+
|
|
71
|
+
## Gaps
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
eumdac-store gaps --config examples/ascat_szf.yaml --days 2 # exit 4 if any
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Lists the store and reports breaks in each group's time chain (groups: the pattern's named groups other than `start`/`end`, e.g. `sat`; or `gap_group_cols`). Consecutive files chain when the next starts `gap_min_seconds`..`gap_max_seconds` after the last one ends (defaults 0..1 s, as SZF). `--start`/`--end` keep the gaps that begin in that window.
|
|
78
|
+
|
|
79
|
+
## Airflow
|
|
80
|
+
|
|
81
|
+
The fetch DAG that keeps a rolling archive filled (e.g. `s3://tuw-ascat-l1b/szf/`) lives in its own repository, **eumdac-fetch**. It installs this package from PyPI at a pinned version, so no image is needed.
|
|
82
|
+
|
|
83
|
+
## Python API
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from eumdac_store import EumdacStore, StoreConfig
|
|
87
|
+
|
|
88
|
+
store = EumdacStore(StoreConfig.from_yaml("examples/ascat_szf.yaml",
|
|
89
|
+
download_root_dir="/data/eumdac",
|
|
90
|
+
))
|
|
91
|
+
result = store.download(days=1) # or start=, end=, specific_dates=
|
|
92
|
+
print(result) # downloaded=… skipped_present=… skipped_quarantined=… failed=…
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Product fields are **required** (no defaults); pass them inline to `StoreConfig(...)` to skip the YAML.
|
|
96
|
+
|
|
97
|
+
## Configuration
|
|
98
|
+
|
|
99
|
+
| Field | Required | Default | Meaning |
|
|
100
|
+
|-------|----------|---------|---------|
|
|
101
|
+
| `collection_id` | **yes** | — | EUMDAC collection to search |
|
|
102
|
+
| `product_name` | **yes** | — | ducats catalog table name (must be a valid identifier)
|
|
103
|
+
| `filename_glob` | **yes** | — | Which files in `<product_name>/` the catalog globs |
|
|
104
|
+
| `filename_pattern` | **yes** | — | Regex for ducats's `RegexExtractor`; `(?P<start>...)` is required, `(?P<end>...)` optional (absent → `end_ts` NULL), other named groups become categorical columns |
|
|
105
|
+
| `download_root_dir` | **yes** | — | EUMDAC data root: `<product_name>/` per product lives here. A directory, or a URL such as `s3://bucket/prefix` (see Object storage) |
|
|
106
|
+
| `storage_options` | no | `{}` | fsspec options for a URL root |
|
|
107
|
+
| `catalog_file` | no | derived | DuckDB catalog path (see below) |
|
|
108
|
+
| `max_workers` | no | 10 | Parallel downloads (hard-clamped to 10) |
|
|
109
|
+
| `max_retries` | no | 3 | Retry budget per file |
|
|
110
|
+
| `quarantine_cooloff_hours` | no | 2.0 | How long a quarantine sidecar suppresses refetch |
|
|
111
|
+
|
|
112
|
+
`product_dir` is `<download_root_dir>/<product_name>/`. The catalog is a local cache of that listing, rebuilt from scratch on every sync, so it is kept out of the data: `catalog_path` is `catalog_file` if set, else `$XDG_CACHE_HOME/eumdac-store/<root>/catalog.duckdb` (`<root>` is the absolute directory without its leading `/`, or `bucket/prefix` for a URL). Losing it costs one sync. A catalog left at `<download_root_dir>/catalog.duckdb` by earlier versions is deleted after the first successful sync, so a copy of the root never carries a stale one.
|
|
113
|
+
|
|
114
|
+
Products under one `download_root_dir` share one catalog (one DuckDB file, one table per `product_name`).
|
|
115
|
+
|
|
116
|
+
Copy `examples/ascat_szf.yaml` for another product. A missing required field is a hard validation error.
|
|
117
|
+
|
|
118
|
+
## Tests
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uv run pytest # no network — a fake EUMDAC DataStore backs every test
|
|
122
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# eumdac-store product config — ASCAT SZF raw zips from the EUMETSAT Data Store.
|
|
2
|
+
#
|
|
3
|
+
# The product-defining fields below are REQUIRED (StoreConfig has no product
|
|
4
|
+
# defaults). Point --config at this file, copy it for another collection, or
|
|
5
|
+
# set the same values as EUMDAC_STORE_* env vars.
|
|
6
|
+
|
|
7
|
+
# EUMDAC collection to search. Find ids in the EUMETSAT Data Store catalogue.
|
|
8
|
+
collection_id: EO:EUM:DAT:METOP:ASCSZF1B
|
|
9
|
+
|
|
10
|
+
# ducats product wiring:
|
|
11
|
+
# product_name — ducats catalog table name for this product
|
|
12
|
+
# filename_glob — which files in <product_name>/ the catalog globs
|
|
13
|
+
# filename_pattern — regex for ducats's RegexExtractor; named groups
|
|
14
|
+
# (?P<start>...)/(?P<end>...) become the temporal
|
|
15
|
+
# bounds, any other named group a categorical column
|
|
16
|
+
product_name: raw
|
|
17
|
+
filename_glob: '*.zip'
|
|
18
|
+
filename_pattern: 'ASCA_SZF_1B_(?P<sat>M\d{2})_(?P<start>\d{14})Z_(?P<end>\d{14})Z_.+\.zip$'
|
|
19
|
+
|
|
20
|
+
# Optional fields (documented defaults):
|
|
21
|
+
# download_root_dir: <REQUIRED> — EUMDAC downloads root; <product_name>/ holds
|
|
22
|
+
# the zips.
|
|
23
|
+
# Or a URL, e.g. s3://tuw-ascat-l1b/eumdac (needs eumdac-store[s3]).
|
|
24
|
+
# storage_options: {} — fsspec options for a URL root, e.g.
|
|
25
|
+
# {profile: tuw-ascat-l1b, endpoint_url: https://objects.eodc.eu}
|
|
26
|
+
# catalog_file: derived — $XDG_CACHE_HOME/eumdac-store/<root>/catalog.duckdb, a
|
|
27
|
+
# local cache of the listing (rebuilt on every sync)
|
|
28
|
+
# max_workers: 10
|
|
29
|
+
# max_retries: 3
|
|
30
|
+
# quarantine_cooloff_hours: 2.0
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# eumdac-store product config — IASI Level 1C all spectral samples (Metop).
|
|
2
|
+
#
|
|
3
|
+
# Polar: M0x satellite letter. The literal "xxx" is part of EUMETSAT's own
|
|
4
|
+
# product id. start+end present.
|
|
5
|
+
#
|
|
6
|
+
# Real name (from the Data Store):
|
|
7
|
+
# IASI_xxx_1C_M01_20260811093254Z_20260811111454Z_N_O_20260811102422Z
|
|
8
|
+
# downloaded as: <that>.zip
|
|
9
|
+
|
|
10
|
+
collection_id: EO:EUM:DAT:METOP:IASIL1C-ALL
|
|
11
|
+
product_name: iasi_l1c
|
|
12
|
+
filename_glob: '*.zip'
|
|
13
|
+
filename_pattern: 'IASI_xxx_1C_(?P<sat>M\d{2})_(?P<start>\d{14})Z_(?P<end>\d{14})Z_N_O_\d{14}Z\.zip$'
|
|
14
|
+
|
|
15
|
+
# Optional fields:
|
|
16
|
+
# download_root_dir: <REQUIRED> — EUMDAC downloads root
|
|
17
|
+
# max_workers: 10
|
|
18
|
+
# max_retries: 3
|
|
19
|
+
# quarantine_cooloff_hours: 2.0
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# eumdac-store product config — Metop Near Real-Time Total Column (NTO).
|
|
2
|
+
#
|
|
3
|
+
# Polar L2 trace-gas product: satellite as text (METOPB/METOPC, not M0x),
|
|
4
|
+
# single timestamp (start only — no end group, so end_ts is NULL).
|
|
5
|
+
# Hyphen-heavy name.
|
|
6
|
+
#
|
|
7
|
+
# Real name (from the Data Store):
|
|
8
|
+
# S-O3M_GOME_O3-NO2-NO2Tropo-HCHO_L2_20260811135657_001_METOPC_40270_DLR_04
|
|
9
|
+
# downloaded as: <that>.zip
|
|
10
|
+
|
|
11
|
+
collection_id: EO:EUM:DAT:METOP:NTO
|
|
12
|
+
product_name: metop_nto
|
|
13
|
+
filename_glob: '*.zip'
|
|
14
|
+
filename_pattern: 'S-O3M_GOME_[\w-]+_L2_(?P<start>\d{14})_\d{3}_(?P<sat>METOP[ABC])_\d+_DLR_\d{2}\.zip$'
|
|
15
|
+
|
|
16
|
+
# Optional fields:
|
|
17
|
+
# download_root_dir: <REQUIRED> — EUMDAC downloads root
|
|
18
|
+
# max_workers: 10
|
|
19
|
+
# max_retries: 3
|
|
20
|
+
# quarantine_cooloff_hours: 2.0
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# eumdac-store product config — MSG High Rate SEVIRI Level 1.5 image data.
|
|
2
|
+
#
|
|
3
|
+
# Geostationary: no M0x satellite letter; the platform is MSG3/MSG4 inside
|
|
4
|
+
# the name. The filename carries a single timestamp (start of the 15-min
|
|
5
|
+
# scene) with a nanosecond fraction — only the 14-digit part is captured.
|
|
6
|
+
# No end group: end_ts is NULL in the catalog. Cadence/contiguity knowledge
|
|
7
|
+
# isn't in the product name, so it belongs in user queries, not ducats.
|
|
8
|
+
#
|
|
9
|
+
# Real name (from the Data Store):
|
|
10
|
+
# MSG3-SEVI-MSG15-0100-NA-20260811095743.442000000Z-NA
|
|
11
|
+
# downloaded as: <that>.zip
|
|
12
|
+
|
|
13
|
+
collection_id: EO:EUM:DAT:MSG:HRSEVIRI
|
|
14
|
+
product_name: hrsevir
|
|
15
|
+
filename_glob: '*.zip'
|
|
16
|
+
filename_pattern: '(?P<sat>MSG\d)-SEVI-MSG15-0100-NA-(?P<start>\d{14})\.\d{9}Z-NA\.zip$'
|
|
17
|
+
|
|
18
|
+
# Optional fields:
|
|
19
|
+
# download_root_dir: <REQUIRED> — EUMDAC downloads root
|
|
20
|
+
# max_workers: 10
|
|
21
|
+
# max_retries: 3
|
|
22
|
+
# quarantine_cooloff_hours: 2.0
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# eumdac-store product config — MTG FCI Level 1c normal resolution (0 deg).
|
|
2
|
+
#
|
|
3
|
+
# Geostationary WMO-style name: commas, plus signs, hyphens, MTI1 satellite.
|
|
4
|
+
# Three timestamps (creation, start, end) — only start/end are captured.
|
|
5
|
+
#
|
|
6
|
+
# Real name (from the Data Store):
|
|
7
|
+
# W_XX-EUMETSAT-Darmstadt,IMG+SAT,MTI1+FCI-1C-RRAD-FDHSI-FD--x-x---x_C_EUMT_20260811095314_IDPFI_OPE_20260811095007_20260811095939_N__O_0060_0000
|
|
8
|
+
# downloaded as: <that>.zip
|
|
9
|
+
|
|
10
|
+
collection_id: EO:EUM:DAT:0662
|
|
11
|
+
product_name: fci_l1c
|
|
12
|
+
filename_glob: '*.zip'
|
|
13
|
+
filename_pattern: 'W_XX-EUMETSAT-Darmstadt,IMG\+SAT,MTI(?P<sat>\d)\+FCI-1C-RRAD-FDHSI-FD--x-x---x_C_EUMT_\d{14}_IDPFI_OPE_(?P<start>\d{14})_(?P<end>\d{14})_N__O_\d{4}_\d{4}\.zip$'
|
|
14
|
+
|
|
15
|
+
# Optional fields:
|
|
16
|
+
# download_root_dir: <REQUIRED> — EUMDAC downloads root
|
|
17
|
+
# max_workers: 10
|
|
18
|
+
# max_retries: 3
|
|
19
|
+
# quarantine_cooloff_hours: 2.0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# eumdac-store product config — Sentinel-3 OLCI Level 1B Full Resolution (NRT).
|
|
2
|
+
#
|
|
3
|
+
# Polar: S3A/S3B satellite letter, three timestamps (start, end, processing)
|
|
4
|
+
# with a T separator — needs filename_ts_format='%Y%m%dT%H%M%S'. Product id
|
|
5
|
+
# ends in .SEN3, downloaded as <id>.zip.
|
|
6
|
+
#
|
|
7
|
+
# Real name (from the Data Store):
|
|
8
|
+
# S3A_OL_1_EFR____20260811T101042_20260811T101235_20260811T133722_0113_142_336_1260_MAR_O_NR_004.SEN3
|
|
9
|
+
# downloaded as: <that>.zip
|
|
10
|
+
|
|
11
|
+
collection_id: EO:EUM:DAT:0409
|
|
12
|
+
product_name: olci_l1b
|
|
13
|
+
filename_glob: '*.zip'
|
|
14
|
+
filename_pattern: '(?P<sat>S3[AB])_OL_1_EFR____(?P<start>\d{8}T\d{6})_(?P<end>\d{8}T\d{6})_\d{8}T\d{6}_\d{4}_\d{3}_\d{3}_\d{4}_[A-Z]{3}_O_[A-Z]{2}_\d{3}\.SEN3\.zip$'
|
|
15
|
+
filename_ts_format: '%Y%m%dT%H%M%S'
|
|
16
|
+
|
|
17
|
+
# Optional fields:
|
|
18
|
+
# download_root_dir: <REQUIRED> — EUMDAC downloads root
|
|
19
|
+
# max_workers: 10
|
|
20
|
+
# max_retries: 3
|
|
21
|
+
# quarantine_cooloff_hours: 2.0
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "eumdac-store"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Robust EUMDAC downloader with integrity validation, quarantine, and a ducats-backed catalog, to a directory or a bucket"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE.txt"]
|
|
9
|
+
authors = [{ name = "TU Wien", email = "remote.sensing@geo.tuwien.ac.at" }]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Programming Language :: Python :: 3",
|
|
12
|
+
"Operating System :: OS Independent",
|
|
13
|
+
"Topic :: Scientific/Engineering",
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
# tested on 4.0.0; a major release may change the API
|
|
17
|
+
"eumdac>=4.0,<5",
|
|
18
|
+
"requests>=2.31",
|
|
19
|
+
"urllib3>=2.0",
|
|
20
|
+
"python-dotenv>=1.0",
|
|
21
|
+
"pydantic>=2.0",
|
|
22
|
+
"pydantic-settings>=2.0",
|
|
23
|
+
"pyyaml>=6.0",
|
|
24
|
+
"ducats>=0.2",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
# Object-store roots (download_root_dir: s3://bucket/prefix).
|
|
29
|
+
s3 = [
|
|
30
|
+
"universal-pathlib>=0.2",
|
|
31
|
+
"s3fs>=2024.6",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Repository = "https://github.com/TUW-GEO/eumdac-store"
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
eumdac-store = "eumdac_store.cli:main"
|
|
39
|
+
|
|
40
|
+
[build-system]
|
|
41
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
42
|
+
build-backend = "hatchling.build"
|
|
43
|
+
|
|
44
|
+
[tool.hatch.version]
|
|
45
|
+
source = "vcs"
|
|
46
|
+
fallback-version = "0.0.0"
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.hooks.vcs]
|
|
49
|
+
version-file = "src/eumdac_store/_version.py"
|
|
50
|
+
|
|
51
|
+
[tool.hatch.build.targets.wheel]
|
|
52
|
+
packages = ["src/eumdac_store"]
|
|
53
|
+
|
|
54
|
+
[dependency-groups]
|
|
55
|
+
dev = [
|
|
56
|
+
"pytest>=8.0",
|
|
57
|
+
"universal-pathlib>=0.2",
|
|
58
|
+
"s3fs>=2024.6",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
testpaths = ["tests"]
|
|
63
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) 2026 TU Wien
|
|
3
|
+
# SPDX-FileContributor: For a full list of authors, see the AUTHORS file.
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from .config import StoreConfig
|
|
8
|
+
from .service import DownloadResult, EumdacStore
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"EumdacStore",
|
|
12
|
+
"StoreConfig",
|
|
13
|
+
"DownloadResult",
|
|
14
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.4.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 4, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|