Skip to content

Add Zarr v3 reader - #853

Draft
ehennestad wants to merge 3 commits into
mainfrom
zarr-support/5-zarr3-reader
Draft

Add Zarr v3 reader#853
ehennestad wants to merge 3 commits into
mainfrom
zarr-support/5-zarr3-reader

Conversation

@ehennestad

Copy link
Copy Markdown
Collaborator

Motivation

Add reader for Zarr v3 files.

Needs: https://github.com/catalystneuro/zarr-matlab

How to test the behavior?

  1. Install zarr-matlab
  2. nwbRead('path/to/zarrFile')

Checklist

  • Have you ensured the PR description clearly describes the problem and solutions?
  • Have you checked to ensure that there aren't other open or previously closed Pull Requests for the same change?
  • If this PR fixes an issue, is the first line of the PR description fix #XX where XX is the issue number?

io.spec.writeEmbeddedSpecifications, io.spec.validateEmbeddedSpecifications,
and io.spec.readEmbeddedSpecifications were hardcoded to raw HDF5 file IDs
(H5G.open, H5L.delete, h5info, H5F.open, H5D.open/read), even though
export/read already go through the io.backend.base.Writer/Reader
abstraction everywhere else. This blocked any non-HDF5 storage backend
(e.g. a Zarr v3 writer) from ever completing nwbExport/nwbRead, since
NwbFile.embedSpecifications passed a raw H5-typed writer.FileId into
these functions regardless of the actual backend.

Adds three methods to the abstract io.backend.base.Writer interface,
implemented for HDF5Writer by delegating to the existing HDF5 utility
functions it already wraps:
  - getEmbeddedSpecLocation() (mirrors the existing Reader-side method)
  - listChildGroupNames(groupPath)
  - deleteNode(nodePath)

writeEmbeddedSpecifications/validateEmbeddedSpecifications now take the
writer object itself and only call through this interface.
readEmbeddedSpecifications now takes the reader object and is
reimplemented using the already-abstract reader.readNodeInfo/
readDatasetValue (no new Reader methods needed). NwbFile.embedSpecifications
and nwbRead's generateEmbeddedSpec are updated accordingly.

Verified against the full existing HDF5 test suite (517/521 passing; the
4 failures are pre-existing HDF5 dynamic-filter-availability issues on
this machine, unrelated to this change) plus manual round-trip checks:
fresh export, edit-mode re-export (exercises the namespace-version
overwrite path), missing-namespace warning, and unused-namespace deletion.

Note: this does not itself add a Zarr v3 writer/reader -- it only removes
the H5-specific blocker so a future non-HDF5 backend can implement
getEmbeddedSpecLocation/listChildGroupNames/deleteNode on the Writer side
(the Reader side already only needs readNodeInfo/readDatasetValue, which
every existing Reader implementation already provides) and get full
nwbExport/nwbRead support for free.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ehennestad
ehennestad force-pushed the zarr-support/5-zarr3-reader branch from a7c904d to 4d725c0 Compare July 10, 2026 05:17
@ehennestad
ehennestad changed the base branch from main to backend-agnostic-spec-embedding July 10, 2026 05:17
@ehennestad
ehennestad force-pushed the zarr-support/5-zarr3-reader branch from 8681c8f to f7dc222 Compare July 19, 2026 15:26
@ehennestad
ehennestad changed the base branch from backend-agnostic-spec-embedding to main July 28, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant