unyt

This is the documentation for unyt (pronounced like “unit”). unyt is a Python library for working with data that has physical units. It was originally developed as part of the yt Project and 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.0 / 2)
>>> print(v_esc.to("km/s"))
11.254544657958482 km/s

Contents:

Indices and tables