Skip to content

Commit c93df60

Browse files
authored
Merge branch 'main' into fix-netcdf4-remote-zarr-detection
2 parents 017713b + a440558 commit c93df60

File tree

5 files changed

+41
-6
lines changed

5 files changed

+41
-6
lines changed

.readthedocs.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ build:
1818
conda:
1919
environment: ci/requirements/doc.yml
2020

21-
formats: []
21+
formats:
22+
- htmlzip

ci/release_contributors.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,32 @@
77
co_author_re = re.compile(r"Co-authored-by: (?P<name>[^<]+?) <(?P<email>.+)>")
88

99

10+
ignored = [
11+
{"name": "dependabot[bot]"},
12+
{"name": "pre-commit-ci[bot]"},
13+
{
14+
"name": "Claude",
15+
"email": [
16+
17+
18+
19+
],
20+
},
21+
]
22+
23+
24+
def is_ignored(name, email):
25+
# linear search, for now
26+
for ignore in ignored:
27+
if ignore["name"] != name:
28+
continue
29+
ignored_email = ignore.get("email")
30+
if ignored_email is None or email in ignored_email:
31+
return True
32+
33+
return False
34+
35+
1036
def main():
1137
repo = git.Repo(".")
1238

@@ -22,11 +48,8 @@ def main():
2248

2349
# deduplicate and ignore
2450
# TODO: extract ignores from .github/release.yml
25-
ignored = ["dependabot", "pre-commit-ci"]
2651
unique_contributors = unique(
27-
contributor
28-
for contributor in contributors.values()
29-
if contributor.removesuffix("[bot]") not in ignored
52+
name for email, name in contributors.items() if not is_ignored(name, email)
3053
)
3154

3255
sorted_ = sorted(unique_contributors)

doc/whats-new.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ Bug fixes
121121
- Allow ``combine_attrs="drop_conflicts"`` to handle objects with ``__eq__`` methods that return
122122
non-bool values (e.g., numpy arrays) without raising ``ValueError`` (:pull:`10726`).
123123
By `Maximilian Roos <https://github.com/max-sixty>`_.
124+
- Fix error raised when writing scalar variables to Zarr with ``region={}``
125+
(:pull:`10796`).
126+
By `Stephan Hoyer <https://github.com/shoyer>`_.
124127

125128
Documentation
126129
~~~~~~~~~~~~~

xarray/backends/zarr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ def _validate_and_autodetect_region(self, ds: Dataset) -> Dataset:
13641364
non_matching_vars = [
13651365
k for k, v in ds.variables.items() if not set(region).intersection(v.dims)
13661366
]
1367-
if non_matching_vars:
1367+
if region and non_matching_vars:
13681368
raise ValueError(
13691369
f"when setting `region` explicitly in to_zarr(), all "
13701370
f"variables in the dataset to write must have at least "

xarray/tests/test_backends.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3443,6 +3443,14 @@ def test_write_region(self, consolidated, compute, use_dask, write_empty) -> Non
34433443
) as actual:
34443444
assert_identical(actual, nonzeros)
34453445

3446+
def test_region_scalar(self) -> None:
3447+
ds = Dataset({"x": 0})
3448+
with self.create_zarr_target() as store:
3449+
ds.to_zarr(store)
3450+
ds.to_zarr(store, region={}, mode="r+")
3451+
with xr.open_zarr(store) as actual:
3452+
assert_identical(actual, ds)
3453+
34463454
@pytest.mark.parametrize("mode", [None, "r+", "a"])
34473455
def test_write_region_mode(self, mode) -> None:
34483456
zeros = Dataset({"u": (("x",), np.zeros(10))})

0 commit comments

Comments
 (0)