This is the documentation for unyt (pronounced like “unit”). This package provides a python library for working with data that has physical units. It was originally developed as part of The yt Project but was split out as an independent project so that other Python projects can easily make use of it.

The unyt library defines the unyt.array.unyt_array and unyt.array.unyt_quantity classes for handling arrays and scalars with units, respectively.

In addition, unyt provides a number of predefined units and physical constants that can be directly imported from from the unyt namespace:

>>> from unyt import G, Mearth, Rearth
>>> v_esc = (2*G*Mearth/Rearth)**(1./2)
>>> print(v_esc.to('km/s'))
11.254342299356159 km/s

Indices and tables