xarray.Variable.chunk#
- Variable.chunk(chunks={}, name=None, lock=None, inline_array=None, chunked_array_type=None, from_array_kwargs=None, **chunks_kwargs)[source]#
Coerce this array’s data into a dask array 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
,tuple
ordict
, optional) – Chunk sizes along each dimension, e.g.,5
,(5, 5)
or{'x': 5, 'y': 5}
.name (
str
, optional) – Used to generate the name for this array in the internal dask graph. Does not need not be unique.lock (
bool
, default:False
) – Passed on todask.array.from_array()
, if the array is not already as dask array.inline_array (
bool
, default:False
) – Passed on todask.array.from_array()
, if the array is not already as dask array.chunked_array_type (
str
, optional) – Which chunked array type to coerce this datasets’ arrays to. Defaults to ‘dask’ if installed, else whatever is registered via the ChunkManagerEntrypoint system. Experimental API that should not be relied upon.from_array_kwargs (
dict
, optional) – Additional keyword arguments passed on to the ChunkManagerEntrypoint.from_array method used to create chunked arrays, via whichever chunk manager is specified through the chunked_array_type kwarg. For example, with dask as the default chunked array type, this method would pass additional kwargs todask.array.from_array()
. Experimental API that should not be relied upon.**chunks_kwargs (
{dim: chunks, ...}
, optional) – The keyword arguments form ofchunks
. One of chunks or chunks_kwargs must be provided.
- Returns
chunked (
xarray.Variable
)
See also
Variable.chunks
,Variable.chunksizes
,xarray.unify_chunks
,dask.array.from_array