STAC Zarr¶
from pathlib import Path
import sys
repo_root = next(
path for path in [Path.cwd(), *Path.cwd().parents]
if (path / "cwl-workflow/app-water-bodies.cwl").is_file()
)
sys.path.insert(0, str(repo_root / "docs"))
from helpers import WorkflowViewer
import cwl_loader
cwl_loader.logger.remove()
cwl_loader.logger.add(sys.stderr, level="INFO")
1
wf = WorkflowViewer.from_file(
str(repo_root / "cwl-workflow/app-water-bodies.cwl"),
entrypoint="water-bodies",
)
Inputs¶
wf.display_inputs(entrypoint="stac-zarr")
| Id | Type | Label | Doc |
|---|---|---|---|
stac_catalog |
Directory |
Input STAC catalog | STAC catalog containing COG products to convert |
overview_levels |
int |
Overview levels | Number of overview levels to generate |
continuous_overview_reducer |
enum |
Continuous reducer | Reducer for continuous variables when building overviews |
categorical_overview_reducer |
enum |
Categorical reducer | Reducer for categorical variables when building overviews |
resolution |
[ null, float ] |
Target resolution | Optional target output spatial resolution |
chunks |
enum |
Chunking mode | Chunking strategy for stac-load (manual or auto) |
chunk_x |
int |
Chunk size X | X chunk size when chunking mode is manual |
chunk_y |
int |
Chunk size Y | Y chunk size when chunking mode is manual |
chunk_time |
int |
Chunk size time | Time chunk size when chunking mode is manual |
consolidate |
boolean |
Consolidate metadata | Write consolidated Zarr metadata after generation |
titiler_eopf_compatible |
boolean |
TiTiler-EOPF compatibility | Deprecated compatibility flag; GeoZarr convention v0.1 root metadata is always emitted |
stac_object_type |
enum |
STAC object type | Output STAC object type to emit (collection or item) |
Outputs¶
wf.display_outputs(entrypoint="stac-zarr")
| Id | Type | Label | Doc |
|---|---|---|---|
zarr_stac_catalog |
Directory |
Zarr STAC catalog | STAC catalog output containing Zarr store metadata |
Class diagram¶
wf.display_class_diagram(entrypoint="stac-zarr")
Validate the generated GeoZarr store¶
The current stac-zarr implementation validates the store during conversion, before
writing STAC output and consolidating metadata. To check an existing CWL output
again, use the module's Python API below. The inputs, outputs, and diagrams above are generated from the current
repository CWL. Rebuild the container images to use the current implementation.
Use a Python 3.12 notebook kernel and install the current module from the repository root into that kernel's environment:
python -m pip install -e command-line-tools/stac-zarr
This installs geozarr-toolkit as a dependency. Set zarr_store below to the
actual .zarr directory produced by the CWL run (not its STAC catalog or the
measurements subgroup).
The check opens the store read-only and uses GeoZarr Toolkit's Python API on the
root and nested nodes. It also checks published Pilot v0.1 convention
declarations, array dimensions and shapes, and pyramid references. A validation
failure raises ValueError; the success message is printed only after all checks
pass. These checks do not claim stable GeoZarr V1 conformance.
from pathlib import Path
from stac_zarr import validate_geozarr_store
# Replace this example with the actual store path from your CWL output.
zarr_store = Path("/path/to/cwl-output/collection-id/collection-id.zarr")
validate_geozarr_store(zarr_store)
print(f"GeoZarr Toolkit validation: PASS ({zarr_store})")