|
52 | 52 | )
|
53 | 53 | from .alignment import _broadcast_helper, _get_broadcast_dims_map_common_coords, align
|
54 | 54 | from .arithmetic import DatasetArithmetic
|
55 |
| -from .common import DataWithCoords, _contains_datetime_like_objects |
| 55 | +from .common import DataWithCoords, _contains_datetime_like_objects, get_chunks |
56 | 56 | from .computation import unify_chunks
|
57 | 57 | from .coordinates import (
|
58 | 58 | DatasetCoordinates,
|
@@ -2090,20 +2090,18 @@ def info(self, buf=None) -> None:
|
2090 | 2090 |
|
2091 | 2091 | @property
|
2092 | 2092 | def chunks(self) -> Mapping[Hashable, Tuple[int, ...]]:
|
2093 |
| - """Block dimensions for this dataset's data or None if it's not a dask |
2094 |
| - array. |
2095 | 2093 | """
|
2096 |
| - chunks: Dict[Hashable, Tuple[int, ...]] = {} |
2097 |
| - for v in self.variables.values(): |
2098 |
| - if v.chunks is not None: |
2099 |
| - for dim, c in zip(v.dims, v.chunks): |
2100 |
| - if dim in chunks and c != chunks[dim]: |
2101 |
| - raise ValueError( |
2102 |
| - f"Object has inconsistent chunks along dimension {dim}. " |
2103 |
| - "This can be fixed by calling unify_chunks()." |
2104 |
| - ) |
2105 |
| - chunks[dim] = c |
2106 |
| - return Frozen(chunks) |
| 2094 | + Mapping from dimension names to block lengths for this dataset's data, or None if |
| 2095 | + the underlying data is not a dask array. |
| 2096 | +
|
| 2097 | + Cannot be modified directly, but can be modified by calling .chunk(). |
| 2098 | +
|
| 2099 | + See Also |
| 2100 | + -------- |
| 2101 | + Dataset.chunk |
| 2102 | + xarray.unify_chunks |
| 2103 | + """ |
| 2104 | + return get_chunks(self.variables.values()) |
2107 | 2105 |
|
2108 | 2106 | def chunk(
|
2109 | 2107 | self,
|
|
0 commit comments