xarray.DataArray.chunk#

DataArray.chunk(chunks={}, name_prefix='xarray-', token=None, lock=False, inline_array=False, **chunks_kwargs)[source]#

Coerce this array’s data into a dask arrays with the given chunks.

If this variable is a non-dask array, it will be converted to dask array. If it’s a dask array, it will be rechunked to the given chunk sizes.

If neither chunks is not provided for one or more dimensions, chunk sizes along that dimension will not be updated; non-dask arrays will be converted into dask arrays with a single block.

Parameters
  • chunks (int, "auto", tuple of int or mapping of Hashable to int, optional) – Chunk sizes along each dimension, e.g., 5, "auto", (5, 5) or {"x": 5, "y": 5}.

  • name_prefix (str, optional) – Prefix for the name of the new dask array.

  • token (str, optional) – Token uniquely identifying this array.

  • lock (optional) – Passed on to dask.array.from_array(), if the array is not already as dask array.

  • inline_array (optional) – Passed on to dask.array.from_array(), if the array is not already as dask array.

  • **chunks_kwargs ({dim: chunks, ...}, optional) – The keyword arguments form of chunks. One of chunks or chunks_kwargs must be provided.

Returns

chunked (xarray.DataArray)