# xarray.Dataset.chunk

#### Dataset.chunk(chunks={}, name_prefix='xarray-', token=None, lock=False, inline_array=False, chunked_array_type=None, from_array_kwargs=None, \*\*chunks_kwargs)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataset.py#L2579-L2712)

Coerce all arrays in this dataset into dask arrays with the given
chunks.

Non-dask arrays in this dataset will be converted to dask arrays. Dask
arrays 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.

Along datetime-like dimensions, a `Resampler` object
(e.g. [`groupers.TimeResampler`](xarray.groupers.TimeResampler.html.md#xarray.groupers.TimeResampler) or [`groupers.SeasonResampler`](xarray.groupers.SeasonResampler.html.md#xarray.groupers.SeasonResampler))
is also accepted.

* **Parameters:**
  * **chunks** ([`int`](https://docs.python.org/3/builtins/functions.html#int), [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) of [`int`](https://docs.python.org/3/builtins/functions.html#int), `"auto"` or [mapping](https://docs.python.org/3/glossary.html#term-mapping) of [hashable](../user-guide/terminology.html.md#term-name) to [`int`](https://docs.python.org/3/builtins/functions.html#int) or `a Resampler`, *optional*) – Chunk sizes along each dimension, e.g., `5`, `"auto"`, or
    `{"x": 5, "y": 5}` or `{"x": 5, "time": TimeResampler(freq="YE")}` or
    `{"time": SeasonResampler(["DJF", "MAM", "JJA", "SON"])}`.
  * **name_prefix** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), *default*: `"xarray-"`) – Prefix for the name of any new dask arrays.
  * **token** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), *optional*) – Token uniquely identifying this dataset.
  * **lock** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`False`](https://docs.python.org/3/builtins/constants.html#False)) – Passed on to [`dask.array.from_array()`](https://docs.dask.org/en/latest/generated/dask.array.from_array.html#dask.array.from_array), if the array is not
    already as dask array.
  * **inline_array** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`False`](https://docs.python.org/3/builtins/constants.html#False)) – Passed on to [`dask.array.from_array()`](https://docs.dask.org/en/latest/generated/dask.array.from_array.html#dask.array.from_array), if the array is not
    already as dask array.
  * **chunked_array_type** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#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`](https://docs.python.org/3/builtins/stdtypes.html#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
    to [`dask.array.from_array()`](https://docs.dask.org/en/latest/generated/dask.array.from_array.html#dask.array.from_array). Experimental API that should not be relied upon.
  * **\*\*chunks_kwargs** (`{dim: chunks, ...}`, *optional*) – The keyword arguments form of `chunks`.
    One of chunks or chunks_kwargs must be provided
* **Returns:**
  **chunked** ([`xarray.Dataset`](xarray.Dataset.html.md#xarray.Dataset))

#### SEE ALSO
[`Dataset.chunks`](xarray.Dataset.chunks.html.md#xarray.Dataset.chunks), [`Dataset.chunksizes`](xarray.Dataset.chunksizes.html.md#xarray.Dataset.chunksizes), [`xarray.unify_chunks`](xarray.unify_chunks.html.md#xarray.unify_chunks), [`dask.array.from_array`](https://docs.dask.org/en/latest/generated/dask.array.from_array.html#dask.array.from_array)
