grids.mixins.chunking.GridChunkingMixin.compute_chunk_centers#

GridChunkingMixin.compute_chunk_centers(chunks: ChunkIndexInput, axes: AxesInput | None = None, include_ghosts: bool = False, halo_offsets: HaloOffsetInput | None = None, oob_behavior: str = 'raise', __validate__: bool = True) List[ndarray][source]#

Return coordinate center arrays for a specific chunk along the selected axes.

If the grid is cell-centered, the coordinates are already centers and are returned directly. If the grid is vertex-centered, centers are computed from the edge coordinates.

Parameters:
  • chunks (ChunkIndexInput) – The chunk index specification (int, tuple, slice, or sequence of those).

  • axes (str or list of str, optional) – Axes to include. If None, all axes are included.

  • include_ghosts (bool, default False) – Whether to include ghost zones when computing chunk extent.

  • halo_offsets (int, sequence[int], or np.ndarray, optional) – Extra ghost-cell-padding to apply on top of the standard ghost zones.

  • oob_behavior ({"raise", "clip"}, default "raise") – What to do if the computed chunk region would go out of bounds.

  • __validate__ (bool, default True) – Whether to validate inputs (axes, shapes, etc).

Returns:

One coordinate array per axis, center-aligned.

Return type:

list of np.ndarray