grids.mixins.core.GridUtilsMixin.check_field_shape#

GridUtilsMixin.check_field_shape(array_shape: Sequence[int], axes: AxesInput | None = None, field_shape: Sequence[int] | None = None) None[source]#

Validate that a field array shape is compatible with the grid over the specified axes.

Parameters:
  • array_shape (Sequence[int]) – The shape of the input array to check.

  • axes (str or list of str, optional) – The axes that the field is defined over. If None, all axes are used.

  • field_shape (Sequence[int], optional) – Expected trailing dimensions (e.g., for vector or tensor fields). If None, no trailing dims are checked.

Raises:

ValueError – If the array’s shape does not match the expected grid shape or combined (grid + field) shape.