Skip to content

Commit 5604853

Browse files
authored
Fix typing for to_zarr() methods (#10847)
* Fix typing for to_zarr() methods Fixes #10444 * fix docstring
1 parent 82a659d commit 5604853

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

xarray/core/dataarray.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
T_ChunkDimFreq,
119119
T_ChunksFreq,
120120
T_Xarray,
121+
ZarrStoreLike,
121122
)
122123
from xarray.groupers import Grouper, Resampler
123124
from xarray.namedarray.parallelcompat import ChunkManagerEntrypoint
@@ -4253,7 +4254,7 @@ def to_netcdf(
42534254
@overload
42544255
def to_zarr(
42554256
self,
4256-
store: MutableMapping | str | PathLike[str] | None = None,
4257+
store: ZarrStoreLike | None = None,
42574258
chunk_store: MutableMapping | str | PathLike | None = None,
42584259
mode: ZarrWriteModes | None = None,
42594260
synchronizer=None,
@@ -4277,7 +4278,7 @@ def to_zarr(
42774278
@overload
42784279
def to_zarr(
42794280
self,
4280-
store: MutableMapping | str | PathLike[str] | None = None,
4281+
store: ZarrStoreLike | None = None,
42814282
chunk_store: MutableMapping | str | PathLike | None = None,
42824283
mode: ZarrWriteModes | None = None,
42834284
synchronizer=None,
@@ -4299,7 +4300,7 @@ def to_zarr(
42994300

43004301
def to_zarr(
43014302
self,
4302-
store: MutableMapping | str | PathLike[str] | None = None,
4303+
store: ZarrStoreLike | None = None,
43034304
chunk_store: MutableMapping | str | PathLike | None = None,
43044305
mode: ZarrWriteModes | None = None,
43054306
synchronizer=None,
@@ -4336,7 +4337,7 @@ def to_zarr(
43364337
43374338
Parameters
43384339
----------
4339-
store : MutableMapping, str or path-like, optional
4340+
store : zarr.storage.StoreLike, optional
43404341
Store or path to directory in local or remote file system.
43414342
chunk_store : MutableMapping, str or path-like, optional
43424343
Store or path to directory in local or remote file system only for Zarr

xarray/core/dataset.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
T_Chunks,
168168
T_DatasetPadConstantValues,
169169
T_Xarray,
170+
ZarrStoreLike,
170171
)
171172
from xarray.groupers import Grouper, Resampler
172173
from xarray.namedarray.parallelcompat import ChunkManagerEntrypoint
@@ -2120,7 +2121,7 @@ def to_netcdf(
21202121
@overload
21212122
def to_zarr(
21222123
self,
2123-
store: MutableMapping | str | PathLike[str] | None = None,
2124+
store: ZarrStoreLike | None = None,
21242125
chunk_store: MutableMapping | str | PathLike | None = None,
21252126
mode: ZarrWriteModes | None = None,
21262127
synchronizer=None,
@@ -2144,7 +2145,7 @@ def to_zarr(
21442145
@overload
21452146
def to_zarr(
21462147
self,
2147-
store: MutableMapping | str | PathLike[str] | None = None,
2148+
store: ZarrStoreLike | None = None,
21482149
chunk_store: MutableMapping | str | PathLike | None = None,
21492150
mode: ZarrWriteModes | None = None,
21502151
synchronizer=None,
@@ -2166,7 +2167,7 @@ def to_zarr(
21662167

21672168
def to_zarr(
21682169
self,
2169-
store: MutableMapping | str | PathLike[str] | None = None,
2170+
store: ZarrStoreLike | None = None,
21702171
chunk_store: MutableMapping | str | PathLike | None = None,
21712172
mode: ZarrWriteModes | None = None,
21722173
synchronizer=None,
@@ -2203,7 +2204,7 @@ def to_zarr(
22032204
22042205
Parameters
22052206
----------
2206-
store : MutableMapping, str or path-like, optional
2207+
store : zarr.storage.StoreLike, optional
22072208
Store or path to directory in local or remote file system.
22082209
chunk_store : MutableMapping, str or path-like, optional
22092210
Store or path to directory in local or remote file system only for Zarr

xarray/core/datatree.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
NetcdfWriteModes,
9292
T_ChunkDimFreq,
9393
T_ChunksFreq,
94+
ZarrStoreLike,
9495
ZarrWriteModes,
9596
)
9697
from xarray.namedarray.parallelcompat import ChunkManagerEntrypoint
@@ -2076,7 +2077,7 @@ def to_netcdf(
20762077
@overload
20772078
def to_zarr(
20782079
self,
2079-
store,
2080+
store: ZarrStoreLike,
20802081
mode: ZarrWriteModes = "w-",
20812082
encoding=None,
20822083
consolidated: bool = True,
@@ -2091,7 +2092,7 @@ def to_zarr(
20912092
@overload
20922093
def to_zarr(
20932094
self,
2094-
store,
2095+
store: ZarrStoreLike,
20952096
mode: ZarrWriteModes = "w-",
20962097
encoding=None,
20972098
consolidated: bool = True,
@@ -2103,7 +2104,7 @@ def to_zarr(
21032104

21042105
def to_zarr(
21052106
self,
2106-
store,
2107+
store: ZarrStoreLike,
21072108
mode: ZarrWriteModes = "w-",
21082109
encoding=None,
21092110
consolidated: bool = True,
@@ -2117,7 +2118,7 @@ def to_zarr(
21172118
21182119
Parameters
21192120
----------
2120-
store : MutableMapping, str or Path, optional
2121+
store : zarr.storage.StoreLike
21212122
Store or path to directory in file system
21222123
mode : {{"w", "w-", "a", "r+", None}, default: "w-"
21232124
Persistence mode: “w” means create (overwrite if exists); “w-” means create (fail if exists);

0 commit comments

Comments
 (0)