fields.buffers.core.UnytArrayBuffer.full#

classmethod UnytArrayBuffer.full(shape: Tuple[int, ...], *args, fill_value: Any = 0.0, **kwargs) UnytArrayBuffer[source]#

Create a buffer filled with a constant value and attached units.

This method accepts either scalar values or unyt_quantity inputs for fill_value. If a unyt_quantity is provided, its units are extracted automatically unless overridden by the units keyword.

Parameters:
  • shape (tuple of int) – Desired shape of the array.

  • fill_value (scalar or unyt_quantity, default 0.0) – The value to fill the array with. Units are inferred if fill_value is a unyt_quantity.

  • *args – Additional arguments passed to numpy.full().

  • **kwargs – Additional keyword arguments passed to numpy.full(). May include: - units : str — to override or explicitly declare output units.

Returns:

A buffer filled with the specified value and tagged with physical units.

Return type:

UnytArrayBuffer

Raises:

TypeError – If the resulting array cannot be coerced into a unyt_array.