grids.mixins.core.GridUtilsMixin.tile_array_to_axes#
- GridUtilsMixin.tile_array_to_axes(array: ndarray, axes_in: AxesInput, axes_out: AxesInput, /, *, include_ghosts: bool = False, halo_offsets: HaloOffsetInput | None = None, oob_behavior: str = 'raise', **kwargs) ndarray [source]#
Tile a lower-dimensional array across the full domain of the grid defined by axes_out.
This function reshapes the input array to match the leading axes in axes_out, inserts singleton dimensions for any missing axes, and tiles (repeats) the data over the selected region of the grid, which may include ghost zones and halos.
- Parameters:
array (
np.ndarray
) – The input array to tile. Its leading dimensions must match the axes in axes_in.axes_in (
str
orlist
ofstr
) – Axes corresponding to the array’s grid-aligned dimensions.axes_out (
str
orlist
ofstr
) – Target axes over which to tile. This defines the full spatial shape.include_ghosts (
bool
, optional) – IfTrue
, then the slice will include the ghost zones around the boundary of the domain. Otherwise (default), the ghost zones are excluded from the resulting slice.halo_offsets (
int
,sequence[int]
, ornp.ndarray
, optional) –Extra padding (in ghost-cell units) to apply on top of the active or ghost-augmented domain.
This allows you to extend the region further outward beyond ghost zones — for example, to reserve additional halo space for multi-pass stencils.
Supported formats:
int: same padding applied to both sides of all axes
sequence of length N: symmetric padding per axis (left = right)
array of shape (2, N): explicit left/right padding per axis
Note
This is applied after ghost zones (if include_ghosts=True). Total padding = ghost zones + halo.
oob_behavior (
{"raise", "clip"}
, default"raise"
) –Determines what to do if the computed slice (after applying ghost zones and halo padding) would extend beyond the allocated grid buffer (__ghost_dd__).
- Options:
”raise” : Raise an IndexError if any part of the slice is out of bounds.
”clip” : Clamp the slice to stay within the valid grid extent.
Use “clip” if you’re performing relaxed operations (e.g., visualization or padding-aware reads), and “raise” for strict enforcement during stencil computations or buffer validation.
**kwargs – Additional keyword arguments passed to np.broadcast_to.
- Returns:
A tiled array broadcasted over the full region selected by axes_out. The trailing dimensions (not in axes_out) are preserved.
- Return type:
np.ndarray
- Raises:
ValueError – If the array is not compatible with the grid or specified axes.