Skip to content

Commit

Permalink
Update for zarr 2.18.0 and zarr 2.18.1 (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 authored May 22, 2024
1 parent 72ff80f commit 07a5bb2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# HDMF-ZARR Changelog

## 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)
### Enhancements
* Added support for python 3.12. @mavaylon1 [#172](https://github.com/hdmf-dev/hdmf-zarr/pull/172)
Expand Down
8 changes: 4 additions & 4 deletions src/hdmf_zarr/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ def write_dataset(self, **kwargs): # noqa: C901
self._written_builders.set_written(builder) # record that the builder has been written
dset.attrs['zarr_dtype'] = type_str
if hasattr(refs, '__len__'):
dset[:] = refs
dset[:] = np.array(refs)
else:
dset[0] = refs
# write a 'regular' dataset without DatasetIO info
Expand Down Expand Up @@ -1287,7 +1287,8 @@ def __list_fill__(self, parent, name, data, options=None): # noqa: C901
# standard write
else:
try:
dset[:] = data # If data is an h5py.Dataset then this will copy the data
dset[:] = np.array(data)
# If data is an h5py.Dataset then this will copy the data
# For compound data types containing strings Zarr sometimes does not like writing multiple values
# try to write them one-at-a-time instead then
except ValueError:
Expand Down Expand Up @@ -1451,8 +1452,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
has_reference = False
Expand Down
7 changes: 7 additions & 0 deletions test_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def _import_from_file(script):
r"datetime.datetime.utcfromtimestamp() *"
)

_deprecation_warning_zarr_store = (
r"The NestedDirectoryStore is deprecated *"
)

def run_gallery_tests():
global TOTAL, FAILURES, ERRORS
logging.info("Testing execution of Sphinx Gallery files")
Expand Down Expand Up @@ -142,6 +146,9 @@ def run_gallery_tests():
# this is triggered from datetime
"ignore", message=_deprecation_warning_datetime, category=DeprecationWarning
)
warnings.filterwarnings(
"ignore", message=_deprecation_warning_zarr_store, category=FutureWarning
)
_import_from_file(script_abs)
except Exception:
print(traceback.format_exc())
Expand Down

0 comments on commit 07a5bb2

Please sign in to comment.