Skip to content

Conversation

@stephprince
Copy link
Contributor

Motivation

Fix hdmf-dev/hdmf-zarr#221.

Zarr does not natively support variable length strings, and validation of vlen string arrays uses the HDF5 specific data.dtype.metadata field. This field is None for Zarr arrays resulting in the data type not being correctly extracted during validation using the get_type method.

How to test the behavior?

Validate an NWB zarr file with an io object input

import datetime
import uuid

import hdmf_zarr
import numpy
import pynwb

nwbfile = pynwb.NWBFile(
    session_description="",
    identifier=str(uuid.uuid4()),
    session_start_time=datetime.datetime.now().astimezone()
)
regular_timestamps = numpy.arange(1.2, 11.2, 2)
timestamps_length = len(regular_timestamps)
time_series = pynwb.TimeSeries(
    name="test_time_series",
    data=numpy.zeros(shape=(timestamps_length, timestamps_length - 1)),
    timestamps=regular_timestamps,
    unit="",
)
nwbfile.add_acquisition(time_series)

nwbfile_path = "test_validation_time_series.nwb.zarr"
with hdmf_zarr.NWBZarrIO(path=nwbfile_path, mode="w") as io:
    io.write(nwbfile)

with hdmf_zarr.NWBZarrIO(path=nwbfile_path, mode="r") as io:
    invalidations = pynwb.validate(io=io)
    print(invalidations) # should be empty []

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Does the PR clearly describe the problem and the solution?
  • Have you reviewed our Contributing Guide?
  • Does the PR use "Fix #XXX" notation to tell GitHub to close the relevant issue numbered XXX when the PR is merged?

@codecov
Copy link

codecov bot commented Nov 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.44%. Comparing base (bbb4658) to head (e5757a5).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1348   +/-   ##
=======================================
  Coverage   92.44%   92.44%           
=======================================
  Files          42       42           
  Lines        9711     9715    +4     
  Branches     1970     1972    +2     
=======================================
+ Hits         8977     8981    +4     
  Misses        461      461           
  Partials      273      273           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

[Bug]: validation error on NWB Zarr file

2 participants