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 dimensi
( # type: ignore[override]
self,
chunks: T_Chunks = {}, # noqa: B006 # even though it's technically unsafe, it is being used intentionally here (#4667)
name: str | None = None,
lock: bool | None = None,
inline_array: bool | None = None,
chunked_array_type: str | ChunkManagerEntrypoint[Any] | None = None,
from_array_kwargs: Any = None,
**chunks_kwargs: Any,
)
| 2668 | return cast("Variable", out) |
| 2669 | |
| 2670 | def chunk( # type: ignore[override] |
| 2671 | self, |
| 2672 | chunks: T_Chunks = {}, # noqa: B006 # even though it's technically unsafe, it is being used intentionally here (#4667) |
| 2673 | name: str | None = None, |
| 2674 | lock: bool | None = None, |
| 2675 | inline_array: bool | None = None, |
| 2676 | chunked_array_type: str | ChunkManagerEntrypoint[Any] | None = None, |
| 2677 | from_array_kwargs: Any = None, |
| 2678 | **chunks_kwargs: Any, |
| 2679 | ) -> Self: |
| 2680 | """Coerce this array's data into a dask array with the given chunks. |
| 2681 | |
| 2682 | If this variable is a non-dask array, it will be converted to dask |
| 2683 | array. If it's a dask array, it will be rechunked to the given chunk |
| 2684 | sizes. |
| 2685 | |
| 2686 | If neither chunks is not provided for one or more dimensions, chunk |
| 2687 | sizes along that dimension will not be updated; non-dask arrays will be |
| 2688 | converted into dask arrays with a single block. |
| 2689 | |
| 2690 | Parameters |
| 2691 | ---------- |
| 2692 | chunks : int, tuple or dict, optional |
| 2693 | Chunk sizes along each dimension, e.g., ``5``, ``(5, 5)`` or |
| 2694 | ``{'x': 5, 'y': 5}``. |
| 2695 | name : str, optional |
| 2696 | Used to generate the name for this array in the internal dask |
| 2697 | graph. Does not need not be unique. |
| 2698 | lock : bool, default: False |
| 2699 | Passed on to :py:func:`dask.array.from_array`, if the array is not |
| 2700 | already as dask array. |
| 2701 | inline_array : bool, default: False |
| 2702 | Passed on to :py:func:`dask.array.from_array`, if the array is not |
| 2703 | already as dask array. |
| 2704 | chunked_array_type: str, optional |
| 2705 | Which chunked array type to coerce this datasets' arrays to. |
| 2706 | Defaults to 'dask' if installed, else whatever is registered via the `ChunkManagerEntrypoint` system. |
| 2707 | Experimental API that should not be relied upon. |
| 2708 | from_array_kwargs: dict, optional |
| 2709 | Additional keyword arguments passed on to the `ChunkManagerEntrypoint.from_array` method used to create |
| 2710 | chunked arrays, via whichever chunk manager is specified through the `chunked_array_type` kwarg. |
| 2711 | For example, with dask as the default chunked array type, this method would pass additional kwargs |
| 2712 | to :py:func:`dask.array.from_array`. Experimental API that should not be relied upon. |
| 2713 | **chunks_kwargs : {dim: chunks, ...}, optional |
| 2714 | The keyword arguments form of ``chunks``. |
| 2715 | One of chunks or chunks_kwargs must be provided. |
| 2716 | |
| 2717 | Returns |
| 2718 | ------- |
| 2719 | chunked : xarray.Variable |
| 2720 | |
| 2721 | See Also |
| 2722 | -------- |
| 2723 | Variable.chunks |
| 2724 | Variable.chunksizes |
| 2725 | xarray.unify_chunks |
| 2726 | dask.array.from_array |
| 2727 | """ |