Skip to content

Releases: FahrenheitResearch/metrust-py

v0.4.3

01 Apr 04:55

Choose a tag to compare

Highlights

  • Added differential CI against pinned MetPy 1.7.1 across Python 3.10 through 3.13 in metrust-only, metpy, and metpy-xarray modes.
  • Added a first-class calc delegation ledger with deterministic tests for delegated and fallback behavior.
  • Added cookbook-style replay coverage for sounding, grid diagnostics, and xarray-heavy workflows.
  • Refreshed GitHub Actions workflows to Node 24-safe action versions.

Fixes

  • Fixed the Python benchmark storm-relative helicity harness.
  • Fixed geospatial_laplacian local fallback behavior.
  • Fixed smooth_window xarray unit handling.
  • Fixed MetPy signature hook recursion when metpy.calc imports after metrust.calc.

metrust 0.4.2

01 Apr 03:00

Choose a tag to compare

metrust 0.4.2 pushes the metpy.calc drop-in work further from wrapper compatibility into broad runtime parity.

Highlights:

  • Reach zero public metpy.calc signature mismatches against MetPy.
  • Expand runtime parity coverage across the remaining 91 reviewed calculation paths, including sounding/profile diagnostics, thermodynamic layer helpers, interpolation/dataset wrappers, wind-profile utilities, and extra kinematics cases.
  • Fix parity-sensitive runtime behavior in parcel_profile, parcel_profile_with_lcl, isentropic_interpolation, mixed_layer_cape_cin, reduce_point_density, get_perturbation, geospatial_gradient, potential_vorticity_baroclinic, and related xarray/lat-lon inference paths.
  • Keep the Rust backend as the default calculation path while allowing a small parity-sensitive subset to delegate to MetPy when it is installed.
  • Update README and docs to reflect public signature parity and the current compatibility model accurately.

Verification:

  • python -m pytest tests/test_metpy_dropin_compat.py tests/test_python_compat.py tests/test_signature_parity.py tests/test_runtime_parity.py tests/test_runtime_parity_interp_dataset.py tests/test_runtime_parity_kinematics_extra.py tests/test_runtime_parity_remaining.py tests/test_runtime_parity_sounding_core.py tests/test_runtime_parity_thermo_layers.py tests/test_runtime_parity_utils_misc.py tests/test_runtime_parity_wind_profiles.py tests/test_gpu_backend.py -q -> 174 passed
  • cargo check -q
  • local wheel build: metrust-0.4.2-cp313-cp313-win_amd64.whl

metrust 0.4.1

31 Mar 23:35

Choose a tag to compare

metrust 0.4.1 fixes the MetPy compatibility regressions identified in the review and narrows the top-level compatibility wording to match the current guarantees.

Highlights:

  • Fix plain NumPy relative-humidity fraction handling in RH-derived thermo functions.
  • Restore common MetPy keyword forms for wind_direction(convention=...), precipitable_water(bottom=..., top=...), and frontogenesis(potential_temperature=...).
  • Support interior moist_lapse(reference_pressure=...) paths.
  • Fix variable-spacing derivative, deformation, and frontogenesis parity on irregular grids.
  • Add focused MetPy compatibility regressions for RH normalization, keyword forms, interior moist-lapse references, and irregular-grid kinematics.
  • Update README/docs/package metadata to say MetPy-compatible calculation layer instead of claiming universal byte-for-byte wrapper parity.

Verification:

  • python -m pytest tests/test_metpy_dropin_compat.py tests/test_python_compat.py tests/test_gpu_backend.py -q -> 30 passed
  • local wheel build: metrust-0.4.1-cp313-cp313-win_amd64.whl

v0.4.0 — Optional GPU Backend

29 Mar 09:29

Choose a tag to compare

Optional GPU Backend (metrust[gpu])

metrust now supports an opt-in CUDA backend via met-cu. The default Rust/CPU backend is unchanged — existing code works exactly as before.

New API

import metrust.calc as mcalc

mcalc.set_backend("gpu")          # switch to CUDA
mcalc.set_backend("cpu")          # back to Rust

with mcalc.use_backend("gpu"):    # scoped switch
    theta = mcalc.potential_temperature(p, t)

Install with: pip install "metrust[gpu]"

11 GPU-Eligible Functions

  • Scalar thermo: potential_temperature, equivalent_potential_temperature, dewpoint
  • Grid kinematics: vorticity, frontogenesis, q_vector
  • Grid composites: compute_cape_cin, compute_srh, compute_shear, compute_pw, composite_reflectivity_from_hydrometeors

All other functions automatically stay on the Rust CPU path.

Benchmark: Real HRRR Data (40 levels, 1059×1799, RTX 5090)

Category MetPy Rust CUDA CUDA/Rust
Scalar thermo (×10) 785 ms 136 ms 26 ms 5.3x
Grid kinematics (×5) 1.48 s 921 ms 32 ms 28x
Grid composites (×5) 3.72 s 1.32 s 2.8x
1D sounding (×6) 22 ms 0.67 ms
GPU-eligible total 4.50 s 1.37 s 3.3x

Highlights: frontogenesis 28x, q_vector 29x, vorticity 10x, compute_cape_cin 4.4x faster on GPU vs Rust.

Full Changelog

  • Add get_backend(), set_backend(), use_backend() API
  • Add metrust[gpu] optional dependency on met-cu>=0.2.1
  • Add 3-column benchmark script (tests/benchmark_gpu.py) with real HRRR data
  • Add 6 GPU backend unit tests