cf.Data.section¶
-
Data.
section
(axes, stop=None, chunks=False, min_step=1, mode='dictionary')[source]¶ Return a dictionary of Data objects, which are the m dimensional sections of this n dimensional Data object, where m <= n. The keys of the dictionary are the indicies of the sections in the original Data object. The m dimensions that are not sliced are marked with None as a placeholder making it possible to reconstruct the original data object. The corresponding values are the resulting sections of type
Data
.- Parameters
- axes: (seqeunce of)
int
This is should be one or more integers of the m indices of the m axes that define the sections of the
Data
object. If axes isNone
(the default) or an empty sequence then all axes are selected.Note that the axes specified by the axes parameter are the one which are to be kept whole. All other axes are sectioned.
- stop:
int
, optional Stop after this number of sections and return. If stop is None all sections are taken.
- chunks:
bool
, optional If True return sections that are of the maximum possible size that will fit in one chunk of memory instead of sectioning into slices of size 1 along the dimensions that are being sectioned.
- min_step:
int
, optional The minimum step size when making chunks. By default this is 1. Can be set higher to avoid size 1 dimensions, which are problematic for linear regridding.
- axes: (seqeunce of)
- Returns
dict
The dictionary of m dimensional sections of the Data object.
Examples:
Section a Data object into 2D slices:
>>> d.section((0, 1))