xdas.split#

xdas.split(da, indices_or_sections='discontinuities', dim='first', tolerance=None)[source]#

Split a data array along a dimension.

Splitting can either be performed at each discontinuity , at a given set of indices (given as a list of int) or in order to get a given number of equal sized chunks (if a single int is provided).

Parameters:
  • da (DataArray) – The data array to split

  • indices_or_sections (str, int or list of int, default="discontinuities") – Describe how the splitting must be done: - If indices_or_section is an integer N, the array will be divided into N almost equal (can differ by one element if the dim size is not a multiple of N). - If indices_or_section is a 1-D array of sorted integers, the entries indicate where the array is split along dim. For example, [2, 3] would, for dim=”first”, result in [da[:2], da[2:3], da[3:]]. - If indices_or_section is one of “discontinuities”, “gaps” or “overlaps”, splitting will occurs at the indices given by Coordinate.get_split_indices.

  • dim (str, optional) – The dimension along which to split, by default “first”

  • tolerance (float or timedelta64, optional) – Passed to Coordinate.get_split_indices if indices_or_section is “discontinuities”, “gaps” or “overlaps” to determine what can be considered as a discontiuity. For time coordinates, numeric values are considered as seconds. Zero tolerance by default.

Returns:

The splitted data array.

Return type:

list of DataArray