Skip to content
forked from pydata/xarray

Commit

Permalink
Fix check for chunk_store in zarr backend (pydata#7923)
Browse files Browse the repository at this point in the history
* Fix check for chunk_store in zarr backend

* Add test and update whats-new

* Update the whats-new message
  • Loading branch information
juntyr authored Jun 23, 2023
1 parent a80ff50 commit e1605f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Bug fixes
By `Tom White <https://github.com/tomwhite>`_ and `Kai Mühlbauer <https://github.com/kmuehlbauer>`_.
- Ensure dtype of reindex result matches dtype of the original DataArray (:issue:`7299`, :pull:`7917`)
By `Anderson Banihirwe <https://github.com/andersy005>`_.
- Fix bug where a zero-length zarr ``chunk_store`` was ignored as if it was ``None`` (:pull:`7923`)
By `Juniper Tyree <https://github.com/juntyr>`_.

Documentation
~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def open_group(
if consolidated is None:
consolidated = False

if chunk_store:
if chunk_store is not None:
open_kwargs["chunk_store"] = chunk_store
if consolidated is None:
consolidated = False
Expand Down
2 changes: 2 additions & 0 deletions xarray/tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -1849,6 +1849,8 @@ def test_with_chunkstore(self) -> None:
with self.create_zarr_target() as store_target, self.create_zarr_target() as chunk_store:
save_kwargs = {"chunk_store": chunk_store}
self.save(expected, store_target, **save_kwargs)
# the chunk store must have been populated with some entries
assert len(chunk_store) > 0
open_kwargs = {"backend_kwargs": {"chunk_store": chunk_store}}
with self.open(store_target, **open_kwargs) as ds:
assert_equal(ds, expected)
Expand Down

0 comments on commit e1605f2

Please sign in to comment.