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
(
self,
chunks: T_Chunks = {}, # noqa: B006 # even though it's unsafe, it is being used intentionally here (#4667)
chunked_array_type: str | ChunkManagerEntrypoint[Any] | None = None,
from_array_kwargs: Any = None,
**chunks_kwargs: Any,
)
| 752 | return dict(zip(self.dims, self.shape, strict=True)) |
| 753 | |
| 754 | def chunk( |
| 755 | self, |
| 756 | chunks: T_Chunks = {}, # noqa: B006 # even though it's unsafe, it is being used intentionally here (#4667) |
| 757 | chunked_array_type: str | ChunkManagerEntrypoint[Any] | None = None, |
| 758 | from_array_kwargs: Any = None, |
| 759 | **chunks_kwargs: Any, |
| 760 | ) -> Self: |
| 761 | """Coerce this array's data into a dask array with the given chunks. |
| 762 | |
| 763 | If this variable is a non-dask array, it will be converted to dask |
| 764 | array. If it's a dask array, it will be rechunked to the given chunk |
| 765 | sizes. |
| 766 | |
| 767 | If neither chunks is not provided for one or more dimensions, chunk |
| 768 | sizes along that dimension will not be updated; non-dask arrays will be |
| 769 | converted into dask arrays with a single block. |
| 770 | |
| 771 | Parameters |
| 772 | ---------- |
| 773 | chunks : int, tuple or dict, optional |
| 774 | Chunk sizes along each dimension, e.g., ``5``, ``(5, 5)`` or |
| 775 | ``{'x': 5, 'y': 5}``. |
| 776 | chunked_array_type: str, optional |
| 777 | Which chunked array type to coerce this datasets' arrays to. |
| 778 | Defaults to 'dask' if installed, else whatever is registered via the `ChunkManagerEntrypoint` system. |
| 779 | Experimental API that should not be relied upon. |
| 780 | from_array_kwargs: dict, optional |
| 781 | Additional keyword arguments passed on to the `ChunkManagerEntrypoint.from_array` method used to create |
| 782 | chunked arrays, via whichever chunk manager is specified through the `chunked_array_type` kwarg. |
| 783 | For example, with dask as the default chunked array type, this method would pass additional kwargs |
| 784 | to :py:func:`dask.array.from_array`. Experimental API that should not be relied upon. |
| 785 | **chunks_kwargs : {dim: chunks, ...}, optional |
| 786 | The keyword arguments form of ``chunks``. |
| 787 | One of chunks or chunks_kwargs must be provided. |
| 788 | |
| 789 | Returns |
| 790 | ------- |
| 791 | chunked : xarray.Variable |
| 792 | |
| 793 | See Also |
| 794 | -------- |
| 795 | Variable.chunks |
| 796 | Variable.chunksizes |
| 797 | xarray.unify_chunks |
| 798 | dask.array.from_array |
| 799 | """ |
| 800 | |
| 801 | if from_array_kwargs is None: |
| 802 | from_array_kwargs = {} |
| 803 | |
| 804 | if chunks is None: |
| 805 | warnings.warn( |
| 806 | "None value for 'chunks' is deprecated. " |
| 807 | "It will raise an error in the future. Use instead '{}'", |
| 808 | category=FutureWarning, |
| 809 | stacklevel=2, |
| 810 | ) |
| 811 | chunks = {} |
nothing calls this directly
no test coverage detected