Changes the chunking pattern of the given array. Called when the .chunk method is called on an xarray object that is already chunked. Parameters ---------- data : dask array Array to be rechunked. chunks : int, tuple, dict or str, optio
(
self,
data: T_ChunkedArray,
chunks: _NormalizedChunks | tuple[int, ...] | _Chunks,
**kwargs: Any,
)
| 325 | raise NotImplementedError() |
| 326 | |
| 327 | def rechunk( |
| 328 | self, |
| 329 | data: T_ChunkedArray, |
| 330 | chunks: _NormalizedChunks | tuple[int, ...] | _Chunks, |
| 331 | **kwargs: Any, |
| 332 | ) -> Any: |
| 333 | """ |
| 334 | Changes the chunking pattern of the given array. |
| 335 | |
| 336 | Called when the .chunk method is called on an xarray object that is already chunked. |
| 337 | |
| 338 | Parameters |
| 339 | ---------- |
| 340 | data : dask array |
| 341 | Array to be rechunked. |
| 342 | chunks : int, tuple, dict or str, optional |
| 343 | The new block dimensions to create. -1 indicates the full size of the |
| 344 | corresponding dimension. Default is "auto" which automatically |
| 345 | determines chunk sizes. |
| 346 | |
| 347 | Returns |
| 348 | ------- |
| 349 | chunked array |
| 350 | |
| 351 | See Also |
| 352 | -------- |
| 353 | dask.array.Array.rechunk |
| 354 | cubed.Array.rechunk |
| 355 | """ |
| 356 | from xarray.core.common import _contains_cftime_datetimes |
| 357 | from xarray.namedarray.utils import _get_chunk |
| 358 | |
| 359 | if _contains_cftime_datetimes(data): |
| 360 | chunks2 = _get_chunk(data, chunks, self, preferred_chunks={}) # type: ignore[arg-type] |
| 361 | else: |
| 362 | chunks2 = chunks # type: ignore[assignment] |
| 363 | return data.rechunk(chunks2, **kwargs) |
| 364 | |
| 365 | @abstractmethod |
| 366 | def compute( |
no test coverage detected