10
10
from xarray .core import utils
11
11
from xarray .core .parallelcompat import ChunkManagerEntrypoint
12
12
from xarray .core .pycompat import is_chunked_array , is_duck_dask_array
13
+ from xarray .core .types import T_Chunks , T_NormalizedChunks
13
14
14
15
T_ChunkedArray = TypeVar ("T_ChunkedArray" )
15
16
16
- # TODO importing TypeAlias is a pain on python 3.9 without typing_extensions in the CI
17
- # T_Chunks: TypeAlias = tuple[tuple[int, ...], ...]
18
- T_Chunks = Any
19
-
20
17
CHUNK_MANAGERS : dict [str , type ["ChunkManagerEntrypoint" ]] = {}
21
18
22
19
if TYPE_CHECKING :
@@ -31,9 +28,21 @@ def __init__(self):
31
28
32
29
self .array_cls = Array
33
30
34
- def chunks (self , data : "CubedArray" ) -> T_Chunks :
31
+ def chunks (self , data : "CubedArray" ) -> T_NormalizedChunks :
35
32
return data .chunks
36
33
34
+ def normalize_chunks (
35
+ self ,
36
+ chunks : T_Chunks ,
37
+ shape : Union [tuple [int ], None ] = None ,
38
+ limit : Union [int , None ] = None ,
39
+ dtype : Union [np .dtype , None ] = None ,
40
+ previous_chunks : T_NormalizedChunks = None ,
41
+ ) -> tuple [tuple [int , ...], ...]:
42
+ from cubed .vendor .dask .array .core import normalize_chunks
43
+
44
+ return normalize_chunks (chunks , shape = shape , limit = limit , dtype = dtype , previous_chunks = previous_chunks )
45
+
37
46
def from_array (self , data : np .ndarray , chunks , ** kwargs ) -> "CubedArray" :
38
47
from cubed import from_array
39
48
@@ -148,7 +157,6 @@ def apply_gufunc(
148
157
output_sizes = None ,
149
158
vectorize = None ,
150
159
allow_rechunk = False ,
151
- meta = None ,
152
160
** kwargs ,
153
161
):
154
162
if allow_rechunk :
0 commit comments