plopp.plotting._slicer.DimensionSlicer#

class plopp.plotting._slicer.DimensionSlicer(obj, *, enable_player=False, keep=None, mode='combined', operation='sum')[source]#

Class that slices out dimensions from the input data and exposes the result in ‘output’ nodes.

This class exists both for simplifying unit tests and for reuse by other plotting functions that want to offer slicing functionality, such as the superplot() function.

Parameters:
  • obj (Variable | DataArray | Dataset | DataGroup[Any] | ndarray | Node | dict[str, Variable | DataArray | Dataset | DataGroup[Any] | ndarray | Node] | list[Node] | tuple[Node, ...]) – The input data.

  • enable_player (bool, default: False) – If True, add a play button to the sliders to automatically step through the slices.

  • keep (list[str] | None, default: None) – The dimensions to be kept, all remaining dimensions will be sliced. This should be a list of dims. If no dims are provided, the last dim will be kept in the case of a 2-dimensional input, while the last two dims will be kept in the case of higher dimensional inputs.

  • mode (Literal['single', 'range', 'combined'], default: 'combined') – The mode of the slicer. This can be ‘single’, ‘range’, or ‘combined’.

  • operation (Literal['sum', 'mean', 'max', 'min', 'nansum', 'nanmean', 'nanmax', 'nanmin'], default: 'sum') – The reduction operation to be applied to the sliced dimensions. This is sum by default.

__init__(obj, *, enable_player=False, keep=None, mode='combined', operation='sum')[source]#

Methods

__init__(obj, *[, enable_player, keep, ...])

Attributes

output

Alias for reduce_nodes whose name is more like an implementation detail.