From 37add1759a934423d6a6ffadf23b18a0bd8e2d95 Mon Sep 17 00:00:00 2001 From: mavaylon1 Date: Thu, 16 May 2024 11:37:31 -0700 Subject: [PATCH 1/6] Read Only --- src/hdmf_zarr/backend.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hdmf_zarr/backend.py b/src/hdmf_zarr/backend.py index 62834374..77c5c68a 100644 --- a/src/hdmf_zarr/backend.py +++ b/src/hdmf_zarr/backend.py @@ -160,7 +160,9 @@ 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 seem to allow for setting items at all. + # 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' From 5cf8cf58a3ef16946f0c8e1773897027dc6c83b0 Mon Sep 17 00:00:00 2001 From: Matthew Avaylon Date: Thu, 16 May 2024 11:43:30 -0700 Subject: [PATCH 2/6] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab4a164a..64ac296c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # HDMF-ZARR Changelog +## 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) + ## 0.7.0 (May 2, 2024) ### Enhancements * Added support for python 3.12. @mavaylon1 [#172](https://github.com/hdmf-dev/hdmf-zarr/pull/172) From bf95e05874b37c248b41221155e387718b8a9b0c Mon Sep 17 00:00:00 2001 From: mavaylon1 Date: Thu, 16 May 2024 11:45:11 -0700 Subject: [PATCH 3/6] Read Only --- src/hdmf_zarr/backend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hdmf_zarr/backend.py b/src/hdmf_zarr/backend.py index 77c5c68a..dd758ee4 100644 --- a/src/hdmf_zarr/backend.py +++ b/src/hdmf_zarr/backend.py @@ -161,7 +161,8 @@ def open(self): # 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 != 'r': - # When we consolidate metadata, we use ConsolidatedMetadataStore. This interface does not seem to allow for setting items at all. + # When we consolidate metadata, we use ConsolidatedMetadataStore. + # This interface does not seem to allow for setting items at all. # 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 From d2063fdc8e5102d2a2ef70cd500339d55cba9a0f Mon Sep 17 00:00:00 2001 From: Matthew Avaylon Date: Thu, 16 May 2024 11:51:52 -0700 Subject: [PATCH 4/6] Update backend.py --- src/hdmf_zarr/backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hdmf_zarr/backend.py b/src/hdmf_zarr/backend.py index dd758ee4..c1ff2c4b 100644 --- a/src/hdmf_zarr/backend.py +++ b/src/hdmf_zarr/backend.py @@ -162,7 +162,7 @@ def open(self): # As a result, when in other modes, the file will not use consolidated metadata. if self.__mode != 'r': # When we consolidate metadata, we use ConsolidatedMetadataStore. - # This interface does not seem to allow for setting items at all. + # 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 From 79a6a8f8fa5c56992072c2ecec9e3de072afd105 Mon Sep 17 00:00:00 2001 From: mavaylon1 Date: Thu, 16 May 2024 15:40:26 -0700 Subject: [PATCH 5/6] Scalar Arrays read --- src/hdmf_zarr/backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hdmf_zarr/backend.py b/src/hdmf_zarr/backend.py index c1ff2c4b..0a866e55 100644 --- a/src/hdmf_zarr/backend.py +++ b/src/hdmf_zarr/backend.py @@ -1454,7 +1454,7 @@ def __read_dataset(self, zarr_obj, name): # Read scalar dataset if dtype == 'scalar': - data = zarr_obj[0] + data = zarr_obj[()] if isinstance(dtype, list): # Check compound dataset where one of the subsets contains references From 5357b2e4eb39bc2302062d9567a373c94a99316a Mon Sep 17 00:00:00 2001 From: Matthew Avaylon Date: Wed, 22 May 2024 13:54:23 -0700 Subject: [PATCH 6/6] Update CHANGELOG.md --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c897f0cf..f70d25c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,6 @@ ## 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) - -## 0.7.0 (May 2, 2024) -### Bug Fixes * 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)