Skip to content

Commit b25a68b

Browse files
committed
change env names for STAC catalog and items for products
1 parent 81f7261 commit b25a68b

4 files changed

Lines changed: 58 additions & 22 deletions

File tree

deep_code/tests/tools/test_publish.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,25 +179,25 @@ def test_publish_builds_pr_params(self, mock_wf, mock_ds):
179179
# S3 credential resolution
180180
# ------------------------------------------------------------------
181181

182-
def test_get_stac_s3_storage_options_prefers_xcube_env_vars(self):
182+
def test_get_stac_s3_storage_options_prefers_stac_env_vars(self):
183183
env = {
184-
"S3_USER_STORAGE_KEY": "xcube-key",
185-
"S3_USER_STORAGE_SECRET": "xcube-secret",
184+
"STAC_S3_KEY": "stac-key",
185+
"STAC_S3_SECRET": "stac-secret",
186186
"AWS_ACCESS_KEY_ID": "aws-key",
187187
"AWS_SECRET_ACCESS_KEY": "aws-secret",
188188
}
189189
with patch.dict(os.environ, env):
190190
opts = self.publisher._get_stac_s3_storage_options()
191-
self.assertEqual(opts["key"], "xcube-key")
192-
self.assertEqual(opts["secret"], "xcube-secret")
191+
self.assertEqual(opts["key"], "stac-key")
192+
self.assertEqual(opts["secret"], "stac-secret")
193193
self.assertEqual(opts["s3_additional_kwargs"], {"ACL": ""})
194194

195195
def test_get_stac_s3_storage_options_falls_back_to_aws_env_vars(self):
196196
env = {"AWS_ACCESS_KEY_ID": "aws-key", "AWS_SECRET_ACCESS_KEY": "aws-secret"}
197197
patched_env = {
198198
k: v
199199
for k, v in os.environ.items()
200-
if k not in ("S3_USER_STORAGE_KEY", "S3_USER_STORAGE_SECRET")
200+
if k not in ("STAC_S3_KEY", "STAC_S3_SECRET")
201201
}
202202
patched_env.update(env)
203203
with patch.dict(os.environ, patched_env, clear=True):
@@ -212,8 +212,8 @@ def test_get_stac_s3_storage_options_returns_acl_suppression_for_boto3_chain(sel
212212
for k, v in os.environ.items()
213213
if k
214214
not in (
215-
"S3_USER_STORAGE_KEY",
216-
"S3_USER_STORAGE_SECRET",
215+
"STAC_S3_KEY",
216+
"STAC_S3_SECRET",
217217
"AWS_ACCESS_KEY_ID",
218218
"AWS_SECRET_ACCESS_KEY",
219219
)

deep_code/tools/new.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def generate_dataset_template(output_path: Optional[str] = None) -> str:
8686
"# {stac_catalog_s3_root}/{collection_id}/item.json (STAC Item for the whole Zarr)\n"
8787
"# and adds a 'child' link from the OSC Collection to this S3 catalog.\n"
8888
"# S3 write credentials are resolved in order from:\n"
89-
"# 1. S3_USER_STORAGE_KEY / S3_USER_STORAGE_SECRET env vars\n"
89+
"# 1. STAC_S3_KEY / STAC_S3_SECRET env vars (STAC-specific, any bucket)\n"
9090
"# 2. AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY env vars\n"
9191
"# 3. boto3 default chain (IAM role, ~/.aws/credentials)\n"
9292
"# stac_catalog_s3_root: s3://[YOUR-BUCKET]/stac/[collection-id]/\n"

deep_code/tools/publish.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,9 @@ def _get_stac_s3_storage_options(self) -> dict:
529529
530530
Priority (first match wins):
531531
532-
1. xcube user-storage env vars — ``S3_USER_STORAGE_KEY`` /
533-
``S3_USER_STORAGE_SECRET`` (already used by :func:`open_dataset`).
532+
1. STAC-specific env vars — ``STAC_S3_KEY`` / ``STAC_S3_SECRET``.
533+
Use these to target any S3 bucket independently of the xcube
534+
user-storage bucket.
534535
2. Standard AWS env vars — ``AWS_ACCESS_KEY_ID`` /
535536
``AWS_SECRET_ACCESS_KEY``.
536537
3. boto3 default credential chain — IAM role attached to the
@@ -539,10 +540,8 @@ def _get_stac_s3_storage_options(self) -> dict:
539540
to this chain automatically; no secrets are required in code.
540541
"""
541542

542-
key = os.environ.get("S3_USER_STORAGE_KEY") or os.environ.get(
543-
"AWS_ACCESS_KEY_ID"
544-
)
545-
secret = os.environ.get("S3_USER_STORAGE_SECRET") or os.environ.get(
543+
key = os.environ.get("STAC_S3_KEY") or os.environ.get("AWS_ACCESS_KEY_ID")
544+
secret = os.environ.get("STAC_S3_SECRET") or os.environ.get(
546545
"AWS_SECRET_ACCESS_KEY"
547546
)
548547
# s3_additional_kwargs={"ACL": ""} suppresses the ACL header that s3fs

docs/configuration.md

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,30 @@
22

33
## Dataset config (YAML)
44
```yaml
5+
# Required
56
dataset_id: your-dataset.zarr
67
collection_id: your-collection
7-
osc_themes: [cryosphere]
8-
osc_region: global
9-
dataset_status: completed # or ongoing/planned
108
license_type: CC-BY-4.0
9+
10+
# Optional
11+
osc_themes: [cryosphere] # must match slugs at opensciencedata.esa.int/themes/catalog
12+
osc_region: global
13+
dataset_status: completed # ongoing | completed | planned (default: ongoing)
1114
documentation_link: https://example.com/docs
12-
access_link: s3://bucket/your-dataset.zarr
15+
access_link: s3://bucket/your-dataset.zarr # defaults to s3://deep-esdl-public/{dataset_id}
16+
17+
# CF parameter overrides (list of {name, units, ...} dicts)
18+
cf_parameter:
19+
- name: sea_surface_temperature
20+
units: kelvin
1321

1422
# Optional: publish a STAC Catalog + Item next to the data on S3.
1523
# When set, a lightweight STAC hierarchy (catalog.json → item.json) is written
1624
# directly to S3 and a "via" link is added to the OSC collection pointing to it.
25+
# S3 write credentials are resolved in order:
26+
# 1. STAC_S3_KEY / STAC_S3_SECRET (STAC-specific, any bucket)
27+
# 2. AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY
28+
# 3. boto3 default chain (IAM role, ~/.aws/credentials)
1729
stac_catalog_s3_root: s3://bucket/stac/your-collection/
1830
```
1931
@@ -29,6 +41,7 @@ stac_catalog_s3_root: s3://bucket/stac/your-collection/
2941
| `dataset_status` | No | One of `ongoing`, `completed`, or `planned` (default: `ongoing`). |
3042
| `access_link` | No | Public S3 URL of the Zarr store. Defaults to `s3://deep-esdl-public/{dataset_id}`. |
3143
| `documentation_link` | No | URL to dataset documentation. |
44+
| `cf_parameter` | No | List of CF metadata dicts to override variable attributes (e.g. `name`, `units`). |
3245
| `stac_catalog_s3_root` | No | S3 root for the dataset-level STAC Catalog/Item. See [STAC Catalog on S3](#stac-catalog-on-s3). |
3346

3447
### STAC Catalog on S3
@@ -52,12 +65,14 @@ The OSC collection gains a `via` link to `catalog.json` so STAC-aware clients
5265
can discover the data path. `rel="child"` is intentionally avoided because the
5366
OSC validator requires every `child` link to resolve inside the metadata repository.
5467

55-
S3 credentials are resolved in this order: `S3_USER_STORAGE_KEY` /
56-
`S3_USER_STORAGE_SECRET` env vars, then `AWS_ACCESS_KEY_ID` /
57-
`AWS_SECRET_ACCESS_KEY`, then the boto3 default chain (IAM role, `~/.aws/credentials`).
68+
S3 credentials for writing the STAC catalog are resolved in this order:
69+
`STAC_S3_KEY` / `STAC_S3_SECRET` env vars (STAC-specific, can target any bucket),
70+
then `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY`,
71+
then the boto3 default chain (IAM role, `~/.aws/credentials`).
5872

5973
## Workflow config (YAML)
6074
```yaml
75+
# Required
6176
workflow_id: your-workflow
6277
properties:
6378
title: "My workflow"
@@ -69,6 +84,8 @@ properties:
6984
name: deepesdl-xcube-1.8.3
7085
python_version: 3.11
7186
env_file: https://example.com/environment.yml
87+
88+
# Optional
7289
jupyter_notebook_url: https://github.com/org/repo/path/to/notebook.ipynb
7390
contact:
7491
- name: Jane Doe
@@ -77,6 +94,26 @@ contact:
7794
- rel: about
7895
type: text/html
7996
href: https://example.org
97+
links:
98+
- rel: related
99+
type: text/html
100+
href: https://example.com/related-resource
101+
title: Related resource
80102
```
81103

104+
### Field reference
105+
106+
| Field | Required | Description |
107+
|---|---|---|
108+
| `workflow_id` | Yes | Unique identifier for the workflow (spaces converted to hyphens, lowercased). |
109+
| `properties.title` | Yes | Human-readable title. |
110+
| `properties.description` | No | Short summary of what the workflow does. |
111+
| `properties.keywords` | No | List of keyword strings. |
112+
| `properties.themes` | No | List of OSC theme slugs. |
113+
| `properties.license` | No | License identifier (e.g. `proprietary`, `CC-BY-4.0`). |
114+
| `properties.jupyter_kernel_info` | No | Kernel name, Python version, and environment file URL. |
115+
| `jupyter_notebook_url` | No | Link to the source notebook on GitHub. When omitted, kernel and application links are skipped. |
116+
| `contact` | No | List of contact objects with `name`, `organization`, and `links`. |
117+
| `links` | No | Additional OGC API record links (e.g. `related`, `describedby`). |
118+
82119
More templates and examples live in `dataset_config.yaml`, `workflow_config.yaml`, and `example-config/`.

0 commit comments

Comments
 (0)