@@ -8,7 +8,7 @@ from deep_code.tools.publish import Publisher
88publisher = Publisher(
99 dataset_config_path = " dataset.yaml" ,
1010 workflow_config_path = " workflow.yaml" ,
11- environment = " staging" ,
11+ environment = " staging" , # "production" | "staging" | "testing"
1212)
1313
1414# Generate files locally (no PR)
@@ -18,3 +18,72 @@ publisher.publish(write_to_file=True, mode="all")
1818publisher.publish(write_to_file = False , mode = " dataset" )
1919```
2020
21+ ` mode ` controls what is published:
22+
23+ | ` mode ` | What is published |
24+ | ---| ---|
25+ | ` "dataset" ` | OSC STAC collection, variable catalogs, product/variable base catalogs, project collection. |
26+ | ` "workflow" ` | OGC API workflow and experiment records, workflow/experiment base catalogs. |
27+ | ` "all" ` | Both of the above (default). |
28+
29+ ---
30+
31+ ## OscDatasetStacGenerator
32+
33+ ` OscDatasetStacGenerator ` can also be used directly when you need more control
34+ over individual artifacts.
35+
36+ ``` python
37+ from deep_code.utils.dataset_stac_generator import OscDatasetStacGenerator
38+
39+ generator = OscDatasetStacGenerator(
40+ dataset_id = " my-dataset.zarr" ,
41+ collection_id = " my-collection" ,
42+ workflow_id = " my-workflow" ,
43+ workflow_title = " My Workflow" ,
44+ license_type = " CC-BY-4.0" ,
45+ osc_themes = [" cryosphere" ],
46+ osc_region = " Global" ,
47+ osc_status = " completed" ,
48+ # Optional: override the default project identifier.
49+ # Controls osc:project on the collection and the link to the project collection.
50+ osc_project = " deep-earth-system-data-lab" ,
51+ )
52+ ```
53+
54+ ### ` osc_project ` parameter
55+
56+ ` osc_project ` defaults to ` "deep-earth-system-data-lab" ` and is used in three places:
57+
58+ 1 . Sets ` osc:project ` on the OSC extension of the generated STAC collection.
59+ 2 . Generates the ` related ` link from the product collection to the project collection
60+ (` ../../projects/{osc_project}/collection.json ` ).
61+ 3 . Determines the file path of the project collection when publishing
62+ (` projects/{osc_project}/collection.json ` ).
63+
64+ ### Automatic project collection creation
65+
66+ When ` Publisher.publish_dataset() ` runs, it checks whether
67+ ` projects/{osc_project}/collection.json ` already exists in the catalog repository:
68+
69+ - ** Missing** — a minimal STAC Collection is created for the project and a ` child `
70+ link is appended to ` projects/catalog.json ` so it is reachable from the catalog root.
71+ - ** Exists** — the existing collection is updated with a ` child ` link to the new
72+ product and ` related ` links for its themes (same behaviour as before).
73+
74+ This means publishing to a new project does not require manual catalog setup.
75+
76+ ### STAC Catalog and Item generation
77+
78+ ``` python
79+ # Build the S3 STAC hierarchy (dict keyed by S3 path)
80+ file_dict = generator.build_zarr_stac_catalog_file_dict(
81+ stac_catalog_s3_root = " s3://bucket/stac/my-collection/"
82+ )
83+ # file_dict contains:
84+ # "s3://bucket/stac/my-collection/catalog.json"
85+ # "s3://bucket/stac/my-collection/my-collection/item.json"
86+ ```
87+
88+ See [ STAC Catalog on S3] ( configuration.md#stac-catalog-on-s3 ) for details on the
89+ generated structure.
0 commit comments