Skip to main content

Add your description here

Project description

Meteo-xAlign

An xarray based package for alignment of meteorological datasets

What is this?

mxalign is an xarray-based package designed for the alignment and verification of meteorological datasets. It standardizes operations across datasets by attaching properties along three main axes:

  • Space: Grid or point-based data
  • Time: Forecasts, observations, or climatology
  • Uncertainty: Deterministic, ensemble, or quantile forecasts

Currently, mxalign also acts as a full execution engine. It can load datasets (e.g., Anemoi inference outputs, observation datasets), apply transformations, align datasets in both space and time to match a reference, safely broadcast NaNs, and execute verification metrics on scaled Dask clusters (Local or Slurm).

⚠️ Roadmap & Future Architecture Changes (planned for v0.2.0): Currently, mxalign handles both alignment and the execution of the verification tooling pipeline, including loading and validation. In the upcoming v0.2.0 release, this architecture will be refactored:

  • Loading will be split out into mlwp-data-loaders.
  • Validation of loaded xr.Datasets will be moved to mlwp-data-specs (which will contain the requirements for each of the dataset traits and the validation logic).
  • Execution of the full verification pipeline (loading, transformations, alignment, and verification) from configuration files may be moved to a separate package in future releases.
  • Tests will be added to mxalign (building on test datasets already integrated into mlwp-data-loaders) that ensure that all alignment operations work correctly (Testing notebook execution inside mxalign is explicitly excluded from the current roadmap).

Python API

mxalign provides building blocks for manual alignment, transformations, and interpolations of xarray datasets. This is ideal for interactive use in Jupyter notebooks or custom Python scripts.

import xarray as xr
from mxalign import load, align_space, align_time, transform

# Load datasets (using registered loaders)
ds_obs = load(name="observations_loader", files=["obs.nc"])
ds_fcst = load(name="anemoi_inference", files=["forecast.nc"])

# Align the forecast spatially to match the observation reference
ds_fcst_aligned_space = align_space(ds_fcst, reference=ds_obs, method="interpolation")

# Align datasets temporally
datasets = {"obs": ds_obs, "fcst": ds_fcst_aligned_space}
aligned_datasets = align_time(datasets, method="intersection")

For a more comprehensive interactive example, check out the introductory notebook.

Executing via a Configuration

For full verification pipeline execution, mxalign uses a YAML configuration file. This allows you to declaratively define how datasets are loaded, transformed, aligned, and verified.

Configuration Contents

The configuration file is divided into several main sections:

datasets:
  # Define datasets to load, specifying the loader, files, and variables
  obs_data:
    loader: observations_loader
    files: ["obs.nc"]
  fcst_data:
    loader: anemoi_inference
    files: ["forecast.nc"]

transformations:
  # Apply transformations to loaded datasets

alignment:
  # Define reference dataset and alignment methods (space, time, NaN broadcasting)
  reference: obs_data
  time:
    method: intersection

verification:
  # Specify the reference dataset and the metrics to calculate
  reference: obs_data
  metrics:
    # define metrics here

Running from the Command Line

The CLI uses Dask to distribute the workload and supports both local execution and execution on Slurm-managed HPC clusters.

Local Execution Run the pipeline on a local Dask cluster:

mxalign local path/to/config.yaml --n_workers 4 --threads_per_worker 1

Slurm Execution Run the pipeline on a Slurm cluster:

mxalign slurm path/to/config.yaml --account your_account --queue your_queue --cores 8 --memory 64GB

Running from Python

You can also execute the entire configuration-driven pipeline directly from Python using the Runner class.

from mxalign.runner import Runner

# Initialize the runner with a YAML config file or a dictionary
runner = Runner("path/to/config.yaml")

# Execute the pipeline: loads, transforms, aligns, and verifies the datasets
runner.run()

# The resulting aligned datasets and computed metrics are accessible via:
aligned_datasets = runner.datasets
metrics = runner.metrics

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mxalign-0.1.0.tar.gz (892.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mxalign-0.1.0-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file mxalign-0.1.0.tar.gz.

File metadata

  • Download URL: mxalign-0.1.0.tar.gz
  • Upload date:
  • Size: 892.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mxalign-0.1.0.tar.gz
Algorithm Hash digest
SHA256 28b1a90fe51c64ad7a3c475d322bf36eec0df7af2cc7b082b1f1975968b299e4
MD5 ce43ecd51ce8e7f5279d93a5f8ab0931
BLAKE2b-256 e7de13899b56e37c65f1e64b7fe0b4952d05f4678857b6421b3142faba484b9e

See more details on using hashes here.

File details

Details for the file mxalign-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mxalign-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mxalign-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12b97806794c3b22656a305bd4c6bdae7e6462a1bc12324f6d50f3ba8d872a2e
MD5 757ae18bb7ae3f715d47cf21c9b9a2a8
BLAKE2b-256 4a119b46fc48285ad9d6eddfada5f54b98a7f745949d71714b531ab2c94f86da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page