pint-xarray
Physical units interface to xarray using Pint
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and fills a genuine gap for scientists and engineers working with xarray who need physical units. The Apache-2.0 license is permissive. Start with it if you're already using xarray and need dimensional tracking; the API is straightforward and the dependency footprint is small.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later.
- Low friction installation with a pure-Python wheel.
- Actively maintained as of 2026-08-14 with recent releases; depends on three well-established packages (xarray, numpy, pint) that are standard in scientific Python.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it safe for most projects.
last release 2026-03-23 (144 days) · last repo commit 2026-08-14 · 119 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 113,278 downloads/mo, #12,347 on PyPI
Alternatives
Verify before relying
pip install pint-xarray
import pint_xarray
import xarray as xr
ds = xr.Dataset({"a": ("x", [0, 1, 2]), "b": ("y", [-3, 5, 1], {"units": "m"})})
q = ds.pint.quantify(a="s")
c = q.pint.to({"a": "ms", "b": "km"})- Whether unit-aware operations preserve xarray's lazy evaluation and chunking (Dask integration).
- Performance impact of unit tracking on large multidimensional arrays.
- Compatibility with xarray's groupby, resample, and other high-level operations when units are attached.
What it is and what it does
pint-xarray bridges Pint's physical units library with xarray's labeled multidimensional arrays, letting you attach and track units on dataset variables and perform unit-aware arithmetic and conversions. It works by registering accessor methods on xarray objects, so you call `.pint.quantify()` to add units, `.pint.to()` to convert between units, and `.pint.dequantify()` to strip units back off.
The package is designed for scientific and engineering workflows where dimensional consistency matters—tracking whether a measurement is in meters or kilometers, seconds or milliseconds—and catching unit mismatches before they propagate through calculations. It integrates directly with xarray's data model, so units stay attached to variables as you slice, combine, or transform datasets.
Use it for
- Attach units to climate or weather model output and convert between unit systems for analysis.
- Track physical dimensions through geophysical data processing pipelines to catch unit errors early.
- Perform dimensional analysis on scientific datasets to ensure unit consistency across operations.
- Convert measurement data from one unit system to another while preserving xarray's labeled structure.
- Build unit-aware data pipelines for physics or engineering simulations using xarray as the data container.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, installs with low friction, and fills a genuine gap for scientists and engineers working with xarray who need physical units. The Apache-2.0 license is permissive. Start with it if you're already using xarray and need dimensional tracking; the API is straightforward and the dependency footprint is small.
Install
pint-xarray on PyPI
Before you install
Low friction installation with a pure-Python wheel. Actively maintained as of 2026-08-14 with recent releases; depends on three well-established packages (xarray, numpy, pint) that are standard in scientific Python.
Requires Python 3.11 or later.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it safe for most projects.
Quickstart
pip install pint-xarray
import pint_xarray
import xarray as xr
ds = xr.Dataset({"a": ("x", [0, 1, 2]), "b": ("y", [-3, 5, 1], {"units": "m"})})
q = ds.pint.quantify(a="s")
c = q.pint.to({"a": "ms", "b": "km"})
Verify before relying
- Whether unit-aware operations preserve xarray's lazy evaluation and chunking (Dask integration).
- Performance impact of unit tracking on large multidimensional arrays.
- Compatibility with xarray's groupby, resample, and other high-level operations when units are attached.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesxarraynumpypint |
| Maintenance | Actively maintained 144 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 113,278 / month, #12,347 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering |
Evidence: pint_xarray-0.6.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “xarray units”
- pint-xarrayAdds physical units support to xarray datasets and data variables…
- spatial_imagespatial-image provides an N-dimensional spatial image data structure…
- xprojXProj is an Xarray extension that provides tools for managing…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also Pint · unyt · xarray-dataclass · Pint-Pandas · ucumvert · typedunits · xarray · hepunits · quantities · spatial_image