API reference

This page contains a auto-generated summary of pint-xarray’s API.

Dataset

xarray.Dataset.pint.quantify([units, …])

Attaches units to each variable in the Dataset.

xarray.Dataset.pint.dequantify()

Removes units from the Dataset and its coordinates.

xarray.Dataset.pint.to([units])

convert the quantities in a DataArray

DataArray

xarray.DataArray.pint.magnitude

the magnitude of the data or the data itself if not a quantity.

xarray.DataArray.pint.units

the units of the data or None if not a quantity.

xarray.DataArray.pint.dimensionality

get the dimensionality of the data or None if not a quantity.

xarray.DataArray.pint.registry

xarray.DataArray.pint.quantify([units, …])

Attaches units to the DataArray.

xarray.DataArray.pint.dequantify()

Removes units from the DataArray and its coordinates.

xarray.DataArray.pint.to([units])

convert the quantities in a DataArray

Testing

pint_xarray.testing.assert_units_equal(a, b)

assert that the units of two xarray objects are equal