xarray-validate

xarray-validate v0.0.6.dev0.

https://img.shields.io/pypi/v/xarray-validate?color=blue https://img.shields.io/github/actions/workflow/status/leroyvn/xarray-validate/ci.yml?branch=main https://img.shields.io/readthedocs/xarray-validate uv Ruff

Welcome to the xarray-validate documentation!

Motivation

This is a maintained refactor of xarray-schema. I needed an xarray validation engine for one of my projects. I saw in the xarray-schema library a good start, but both its maintenance status and the foreseen integration of its feature set into the much larger Pandera library seemed uncertain. I therefore decided to fork the project, refactor it and add the features I was missing.

Features

  • ⬆️ DataArray and Dataset validation

  • ⬆️ Basic Python type serialization / deserialization

  • Construct schema from existing xarray data

  • 🚫 JSON roundtrip (not guaranteed to work)

⬆️ Inherited from xarray-schema 🚫 Won’t do / won’t fix

Installation

Required dependencies:

  • Python 3.8 or later

  • xarray 2024 or later

Install from PyPI in your virtual environment:

python -m pip install xarray-validate

Available extras:

  • yaml: Load schemas from YAML files.

  • units: Validate unit values in attributes using the Pint library.

  • dask: Validate xarray containers based on dask arrays (experimental).

To install all extras:

python -m pip install "xarray-validate[all]"

Development installation:

uv sync --dev --all-extras