fields.buffers.core.ArrayBuffer.as_unyt_array#

ArrayBuffer.as_unyt_array() unyt_array#

Convert the buffer contents into a unyt_array with attached units.

This method returns the contents of the buffer as a unyt.unyt_array, using the physical units defined by the buffer (via the units property). This is particularly useful when working with buffers that store physical quantities and need to interoperate with unit-aware calculations.

If the buffer has no defined units (self.units is None), the array is returned as a dimensionless unyt_array.

Returns:

A unit-aware array representing the contents of this buffer.

Return type:

unyt.unyt_array

See also

BufferBase.units

The unit system attached to the buffer.

BufferBase.as_array

Returns the underlying array as a NumPy array.