Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Dataset Validator

mlcast-dataset-validator is the validation tool for datasets contributed to the MLCast Intake catalog (mlcast-datasets). It ensures a dataset meets the technical requirements for inclusion in the MLCast data collection before submission.

Full specification docs: https://mlcast-community.github.io/mlcast-dataset-validator/

Why it exists

During the MLCast community meeting, multiple entities offered to contribute datasets. To streamline contribution and ensure data quality, the validator lets providers verify their Zarr archives are compliant before submitting. It addresses two needs:

  1. Specification compliance — validates datasets against the formal MLCast Zarr format specification v1.0 (RFC 2119 keywords).

  2. Tool compatibility — tests that datasets work correctly with common geospatial tools (xarray, GDAL, cartopy).

What it validates

Currently covers radar precipitation source datasets.

Minimum requirements for acceptance

Technical requirements

Tool compatibility

How it is organized

mlcast_dataset_validator/
├── specs/
│   ├── source_data/
│   │   └── radar_precipitation.py
│   ├── training_data/          # no specs yet
│   └── cli.py
└── checks/
    ├── coords/                 # names, spatial, temporal, variable_timestep
    ├── data_vars/
    ├── global_attributes/
    └── tool_compatibility/

Usage

From the command line

Easiest path: run the PyPI release directly with uv:

uvx --from mlcast-dataset-validator mlcast.validate_dataset <data_stage> <product> <dataset-path>

Validate a local Zarr dataset:

uvx --from mlcast-dataset-validator mlcast.validate_dataset \
    source_data radar_precipitation /path/to/radar_precip_source.zarr

Validate a remote Zarr in an S3 bucket at a custom endpoint (here the Radklim Zarr already in the intake catalog):

uvx --from mlcast-dataset-validator mlcast.validate_dataset \
    source_data radar_precipitation \
    s3://mlcast-source-datasets/radklim/v0.1.1/5_minutes.zarr/ \
    --s3-endpoint-url https://object-store.os-api.cci2.ecmwf.int --s3-anon

Or clone and run directly:

git clone https://github.com/mlcast-community/mlcast-dataset-validator
cd mlcast-dataset-validator
pip install -e .
mlcast.validate_dataset source_data radar_precipitation /path/to/zarr/file.zarr

From Python

Import the relevant spec and call it with an xr.Dataset. This is how the validator runs in the CI of the mlcast-datasets repo, validating datasets on every PR and main-branch commit.

import xarray as xr
from mlcast_dataset_validator.specs.source_data import radar_precipitation

storage_options = {
    "endpoint_url": "https://object-store.os-api.cci2.ecmwf.int",
    "anon": True,
}

ds = xr.open_zarr(
    "s3://mlcast-source-datasets/radklim/v0.1.1/5_minutes.zarr/",
    storage_options=storage_options,
)
# Preserve storage options so zarr_format checks can inspect remote-store metadata.
ds.encoding.setdefault("storage_options", storage_options)

report, _ = radar_precipitation.validate_dataset(ds)
report.console_print()