File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 21
21
from xarray .backends .store import StoreBackendEntrypoint
22
22
from xarray .core import indexing
23
23
from xarray .core .parallelcompat import guess_chunkmanager
24
- from xarray .core .pycompat import integer_types
24
+ from xarray .core .pycompat import integer_types , is_chunked_array
25
25
from xarray .core .types import ZarrWriteModes
26
26
from xarray .core .utils import (
27
27
FrozenDict ,
@@ -46,7 +46,7 @@ def initialize_zarr(
46
46
ds : Dataset ,
47
47
store : MutableMapping | None = None ,
48
48
* ,
49
- region_dims : Iterable [Hashable ] | None = None ,
49
+ region_dims : Iterable [Hashable ] = tuple () ,
50
50
mode : Literal ["w" , "w-" ] = "w-" ,
51
51
consolidated : bool | None = None ,
52
52
zarr_version : int | None = None ,
@@ -90,7 +90,7 @@ def initialize_zarr(
90
90
if "compute" in kwargs :
91
91
raise ValueError ("The ``compute`` kwarg is not supported in `initialize_zarr`." )
92
92
93
- if not ds .chunks :
93
+ if not any ( is_chunked_array ( v . _data ) for v in ds ._variables . values ()) :
94
94
raise ValueError ("This function should be used with chunked Datasets." )
95
95
96
96
if mode not in ["w" , "w-" ]:
Original file line number Diff line number Diff line change @@ -5490,6 +5490,7 @@ def test_initialize_zarr(tmp_path) -> None:
5490
5490
# 4. mode = r?
5491
5491
# 5. mode=w+?
5492
5492
# 5. no region_dims
5493
+ # different chunksizes along same dimension
5493
5494
x = np .arange (0 , 50 , 10 )
5494
5495
y = np .arange (0 , 20 , 2 )
5495
5496
data = dask .array .ones ((5 , 10 ), chunks = (1 , - 1 ))
You can’t perform that action at this time.
0 commit comments