Skip to content

Commit

Permalink
Mandate kwargs on to_zarr (#8257)
Browse files Browse the repository at this point in the history
* Mandate kwargs on `to_zarr`

This aleviates some of the dangers of having these in a different order between `da` & `ds`.

_Technically_ it's a breaking change, but only very technically, given that I would wager literally no one has a dozen positional arguments to this method. So I think it's OK.
  • Loading branch information
max-sixty authored Oct 4, 2023
1 parent 8d54acf commit 25c7689
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ New Features
Breaking changes
~~~~~~~~~~~~~~~~

- :py:meth:`Dataset.to_zarr` & :py:meth:`DataArray.to_zarr` require keyword
arguments after the initial 7 positional arguments.
By `Maximilian Roos <https://github.com/max-sixty>`_.


Deprecations
~~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,7 @@ def to_zarr(
synchronizer=None,
group: str | None = None,
encoding: Mapping | None = None,
*,
compute: Literal[True] = True,
consolidated: bool | None = None,
append_dim: Hashable | None = None,
Expand Down Expand Up @@ -1573,6 +1574,7 @@ def to_zarr(
synchronizer=None,
group: str | None = None,
encoding: Mapping | None = None,
*,
compute: bool = True,
consolidated: bool | None = None,
append_dim: Hashable | None = None,
Expand Down
2 changes: 2 additions & 0 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -4010,6 +4010,7 @@ def to_zarr(
mode: Literal["w", "w-", "a", "r+", None] = None,
synchronizer=None,
group: str | None = None,
*,
encoding: Mapping | None = None,
compute: Literal[True] = True,
consolidated: bool | None = None,
Expand Down Expand Up @@ -4050,6 +4051,7 @@ def to_zarr(
synchronizer=None,
group: str | None = None,
encoding: Mapping | None = None,
*,
compute: bool = True,
consolidated: bool | None = None,
append_dim: Hashable | None = None,
Expand Down
2 changes: 2 additions & 0 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,7 @@ def to_zarr(
synchronizer=None,
group: str | None = None,
encoding: Mapping | None = None,
*,
compute: Literal[True] = True,
consolidated: bool | None = None,
append_dim: Hashable | None = None,
Expand Down Expand Up @@ -2336,6 +2337,7 @@ def to_zarr(
synchronizer=None,
group: str | None = None,
encoding: Mapping | None = None,
*,
compute: bool = True,
consolidated: bool | None = None,
append_dim: Hashable | None = None,
Expand Down

0 comments on commit 25c7689

Please sign in to comment.