ocf-dataservices ingests, validates, and converts Numerical Weather Prediction (NWP) datasets
into a standardized Icechunk (Zarr v3) storage format for Open Climate Fix
machine learning pipelines.
Each data module runs in two modes:
- Dagster mode: Orchestrated archive backfills and scheduled runs via Dagster.
- Standalone CLI mode: Direct container execution outside Dagster using the shared CLI runner
in
packages/storage.
This repository is a uv workspace with three layers:
src/ocf_dataservices: The Dagster orchestration layer. It defines assets (defs/), IO managers, and resources (resources/), and registers them indefinitions.py. It contains no provider-specific parsing logic.packages/*-data: Provider data modules. Each module is an isolated workspace package with its own dependencies, schema, download client, transform logic, and standalone CLI entrypoint.packages/storage: Shared Icechunk storage writer (storage.store) and standalone CLI runner (storage.cli). Both Dagster (XarrayIcechunkIOManager) and the standalone package CLIs callstorage.store.write_to_icechunk.packages/schemas: Shared Pandera validation base model (NwpDatasetSchema), coordinate and variable field builders, dimension ordering helpers, and GRIB file verification.
Dependencies flow in one direction:
ocf_dataservices -> packages/*-data -> packages/storage -> packages/schemas.
| Package | CLI command | --product values |
Source |
|---|---|---|---|
ceda-data |
ceda-data |
ukv_uk, global_west_europe |
CEDA DAP MetOffice archive |
dynamical-data |
dynamical-data |
ens_uk |
Dynamical.org public Zarr archive |
ecmwflive-data |
ecmwflive-data |
hres_west_europe, hres_india |
ECMWF real-time S3 GRIB dissemination |
ecmwfmars-data |
ecmwfmars-data |
ens_uk, hres_west_europe |
ECMWF MARS archive API |
metoffice-data |
metoffice-data |
global_west_europe, global_india, ukv_uk |
MetOffice Weather DataHub order API |
Dagster assets are organized into three tiers:
- L0 (raw): Data stored in its original format (such as a multi-message GRIB file) via
RawFileIOManager. Each L0 file is verified for minimum byte size (>= 100 KB), the leadingGRIBmagic header, and the trailing7777end-of-message marker. - L1 (validated): Data parsed into an
xarray.Dataset, renamed to canonical variable names, converted to standard units, and validated against apanderaschema.XarrayIcechunkIOManagerwrites the dataset to an Icechunk repository and updates the monthlystatsgroup. Machine learning pipelines read from this tier. - L2 (derived): Reserved for derived datasets such as multi-provider blends or resampled grids.
The container image built from Containerfile installs all workspace packages and their CLI
entrypoints into /app/.venv/bin.
To run a single forecast initialization time in a container:
docker run --rm --env-file .env \
ghcr.io/openclimatefix/ocf-dataservices:devsjc-rewrite \
ecmwfmars-data \
--product hres_west_europe \
--init-time 2026-01-10T12:00 \
--store-path s3://my-example-bucket/west-europe.icechunkTo run a range of forecast initialization times:
docker run --rm --env-file .env \
ghcr.io/openclimatefix/ocf-dataservices:devsjc-rewrite \
ceda-data \
--product ukv_uk \
--start 2024-01-01T00:00 \
--end 2024-01-31T18:00 \
--step-hours 6 \
--store-path s3://my-example-bucket/ceda-ukv.icechunkPass --no-write-stats to skip computing and updating the monthly stats Zarr group during standalone CLI runs.
Every data module follows a standard directory layout:
packages/<provider>-data/
pyproject.toml # Provider dependencies, `schemas`, `storage`, and `[project.scripts]`
README.md
src/<provider>_data/
schema.py # Pandera schema: dimensions, bounds, and chunk/shard layout
download.py # Raw file download functions
processing.py # `_read_raw_grib` -> `_transform` -> `@validates(Schema)` entrypoint
client.py # Optional API client wrapper
cli.py # Standalone CLI entrypoint using `storage.cli.run_cli`
tests/
test_*.py
Each module separates data ingestion into three steps:
- Fetch (
_read_raw_gribor_compute): Performs all file or network I/O and returns rawxarrayobjects with native provider variable names. - Transform (
_transform): Performs pure in-memory transformations. It extracts GRIB metadata attributes intoinit_timeauxiliary coordinates, renames variables and coordinates, converts units, slices spatial and temporal bounds, and callsschemas.dim_order.enforce_dim_order. - Validated entrypoint: Composes the fetch and transform steps and applies the
@schemas.validates(Schema)decorator. Callers must use this function to guarantee schema compliance.
- Create
packages/<provider>-data/withpyproject.toml,src/<provider>_data/__init__.py, andtests/. - Add
<provider>-datato the rootpyproject.tomlunderdependenciesand[tool.uv.sources], then runuv sync --all-packages. - Define the product schema in
schema.pyby subclassingschemas.base.NwpDatasetSchema. - Implement the fetch, transform, and
@schemas.validatesfunctions indownload.pyandprocessing.py. - Implement
cli.pyusingstorage.cli.ProductSpecandstorage.cli.run_cli, and register the script inpackages/<provider>-data/pyproject.tomlunder[project.scripts]. - Add unit tests under
packages/<provider>-data/tests/testing_transformwith synthetic datasets and testing the validated entrypoint with mocked I/O. - If the module is orchestrated by Dagster, add L0 and L1 assets under
src/ocf_dataservices/defs/assets/and register them insrc/ocf_dataservices/definitions.py.
make run: Start the local Dagster UI and daemon (uv run dg dev).make lint: Run Ruff (uv run ruff check --fix .).make test: Run the full unit test suite acrosstests/andpackages/*/tests.uv run ty check: Run static type checking across the workspace.
Containerfile builds a self-contained image containing the virtual environment at /app/.venv.
By default, it starts the Dagster gRPC code server (dagster api grpc -m ocf_dataservices.definitions).
docker-compose.yaml runs the full Dagster service stack (dagster-postgres, dagster-codeserver,
dagster-webserver, and dagster-daemon). Runs execute in isolated containers via
dagster_docker.DockerRunLauncher.
To deploy on a host:
- Copy
docker-compose.yamlto/etc/dagster/docker-compose.yaml. - Create
/etc/dagster/.envwith required environment variables (L0_ROOT_PATH,L1_ROOT_PATH,ECMWF_API_KEY,ECMWF_API_EMAIL,ECMWF_API_URL,CEDA_USER,CEDA_PASS,ECMWF_REALTIME_S3_BUCKET,ECMWF_REALTIME_S3_ACCESS_KEY,ECMWF_REALTIME_S3_ACCESS_SECRET,METOFFICE_API_KEY). - Start the stack with
docker compose -f /etc/dagster/docker-compose.yaml up -d.