fields.components.FieldComponent.__init__#

FieldComponent.__init__(grid: GridBase, buffer: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], axes: Sequence[str], /, **kwargs)[source]#

Initialize a FieldComponent instance.

Parameters:
  • grid (GridBase) – The structured grid over which the field is defined.

  • buffer (ArrayLike) – The data buffer representing field values. This can be a NumPy array, unyt array, h5py dataset, or other supported backend. It will be wrapped automatically using buffer_from_array.

  • axes (Sequence[str]) – The sequence of axis labels corresponding to spatial dimensions of the buffer. These should match dimensions in the grid.

  • **kwargs – Additional keyword arguments passed to buffer_from_array.

Raises:

ValueError – If the shape of the buffer is inconsistent with the grid and axes.