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 dimens
(
self,
chunks: T_ChunksFreq = {}, # noqa: B006 # {} even though it's technically unsafe, is being used intentionally here (#4667)
*,
name_prefix: str = "xarray-",
token: str | None = None,
lock: bool = False,
inline_array: bool = False,
chunked_array_type: str | ChunkManagerEntrypoint | None = None,
from_array_kwargs=None,
**chunks_kwargs: T_ChunkDimFreq,
)
| 1405 | return get_chunksizes(all_variables) |
| 1406 | |
| 1407 | def chunk( |
| 1408 | self, |
| 1409 | chunks: T_ChunksFreq = {}, # noqa: B006 # {} even though it's technically unsafe, is being used intentionally here (#4667) |
| 1410 | *, |
| 1411 | name_prefix: str = "xarray-", |
| 1412 | token: str | None = None, |
| 1413 | lock: bool = False, |
| 1414 | inline_array: bool = False, |
| 1415 | chunked_array_type: str | ChunkManagerEntrypoint | None = None, |
| 1416 | from_array_kwargs=None, |
| 1417 | **chunks_kwargs: T_ChunkDimFreq, |
| 1418 | ) -> Self: |
| 1419 | """Coerce this array's data into a dask arrays with the given chunks. |
| 1420 | |
| 1421 | If this variable is a non-dask array, it will be converted to dask |
| 1422 | array. If it's a dask array, it will be rechunked to the given chunk |
| 1423 | sizes. |
| 1424 | |
| 1425 | If neither chunks is not provided for one or more dimensions, chunk |
| 1426 | sizes along that dimension will not be updated; non-dask arrays will be |
| 1427 | converted into dask arrays with a single block. |
| 1428 | |
| 1429 | Along datetime-like dimensions, a pandas frequency string is also accepted. |
| 1430 | |
| 1431 | Parameters |
| 1432 | ---------- |
| 1433 | chunks : int, "auto", tuple of int or mapping of hashable to int or a pandas frequency string, optional |
| 1434 | Chunk sizes along each dimension, e.g., ``5``, ``"auto"``, ``(5, 5)`` or |
| 1435 | ``{"x": 5, "y": 5}`` or ``{"x": 5, "time": "YE"}``. |
| 1436 | name_prefix : str, optional |
| 1437 | Prefix for the name of the new dask array. |
| 1438 | token : str, optional |
| 1439 | Token uniquely identifying this array. |
| 1440 | lock : bool, default: False |
| 1441 | Passed on to :py:func:`dask.array.from_array`, if the array is not |
| 1442 | already as dask array. |
| 1443 | inline_array: bool, default: False |
| 1444 | Passed on to :py:func:`dask.array.from_array`, if the array is not |
| 1445 | already as dask array. |
| 1446 | chunked_array_type: str, optional |
| 1447 | Which chunked array type to coerce the underlying data array to. |
| 1448 | Defaults to 'dask' if installed, else whatever is registered via the `ChunkManagerEntryPoint` system. |
| 1449 | Experimental API that should not be relied upon. |
| 1450 | from_array_kwargs: dict, optional |
| 1451 | Additional keyword arguments passed on to the `ChunkManagerEntrypoint.from_array` method used to create |
| 1452 | chunked arrays, via whichever chunk manager is specified through the `chunked_array_type` kwarg. |
| 1453 | For example, with dask as the default chunked array type, this method would pass additional kwargs |
| 1454 | to :py:func:`dask.array.from_array`. Experimental API that should not be relied upon. |
| 1455 | **chunks_kwargs : {dim: chunks, ...}, optional |
| 1456 | The keyword arguments form of ``chunks``. |
| 1457 | One of chunks or chunks_kwargs must be provided. |
| 1458 | |
| 1459 | Returns |
| 1460 | ------- |
| 1461 | chunked : xarray.DataArray |
| 1462 | |
| 1463 | See Also |
| 1464 | -------- |