Skip to content

Commit

Permalink
Don't open with consolidated metadata in mode r+ (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 authored May 26, 2024
1 parent 07a5bb2 commit 0b72774
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# HDMF-ZARR Changelog

## 0.7.0 (May 2, 2024)
## 0.8.0 (Upcoming)
### Bug Fixes
* Fixed bug when opening a file in with `mode=r+`. The file will open without using the consolidated metadata. @mavaylon1 [#182](https://github.com/hdmf-dev/hdmf-zarr/issues/182)
* Fixed bug on how we access scalar arrays. Added warning filter for Zarr deprecation of NestedDirectoryStore. Fixed bug on how we write a dataset of references. @mavaylon1 [#195](https://github.com/hdmf-dev/hdmf-zarr/pull/195)

## 0.7.0 (May 2, 2024)
Expand Down
6 changes: 5 additions & 1 deletion src/hdmf_zarr/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def open(self):
if self.__file is None:
# Within zarr, open_consolidated only allows the mode to be 'r' or 'r+'.
# As a result, when in other modes, the file will not use consolidated metadata.
if self.__mode not in ['r', 'r+']:
if self.__mode != 'r':
# When we consolidate metadata, we use ConsolidatedMetadataStore.
# This interface does not allow for setting items.
# In the doc string, it says it is "read only". As a result, we cannot use r+ with consolidate_metadata.
# r- is only an internal mode in ZarrIO to force the use of regular open. For Zarr we need to
# use the regular mode r when r- is specified
mode_to_use = self.__mode if self.__mode != 'r-' else 'r'
Expand Down Expand Up @@ -1453,6 +1456,7 @@ def __read_dataset(self, zarr_obj, name):
# Read scalar dataset
if dtype == 'scalar':
data = zarr_obj[()]

if isinstance(dtype, list):
# Check compound dataset where one of the subsets contains references
has_reference = False
Expand Down

0 comments on commit 0b72774

Please sign in to comment.