hdmf-dev / hdmf-zarr

Zarr I/O backend for HDMF
https://hdmf-zarr.readthedocs.io/
Other
7 stars 6 forks source link

[Bug]: datetimes in pynwb.validate on NWB Zarr #220

Open CodyCBakerPhD opened 1 month ago

CodyCBakerPhD commented 1 month ago

What happened?

Ran across this while debugging Zarr support for NWB Inspector https://github.com/NeurodataWithoutBorders/nwbinspector/pull/513

I can bypass it there since it's a flag whether or not to trigger validation checks, but this should be fixed in the validation (either PyNWB or HDMF Zarr) soonish so that dandi validate (which does enforce it) can work on Zarr files

Steps to Reproduce

import datetime
import uuid

import hdmf_zarr
import pynwb

nwbfile = pynwb.NWBFile(
    session_description="",
    identifier=str(uuid.uuid4()),
    session_start_time=datetime.datetime.now().astimezone()
)

nwbfile_path = "..somewhere/test_validation.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)

Traceback

[root/file_create_date (file_create_date): incorrect type - expected 'isodatetime', got '['int', 'int', 'int', 'int', 'int']']

Operating System

Windows

Python Executable

Conda

Python Version

3.12

Package Versions

No response

Code of Conduct

mavaylon1 commented 1 month ago

Thanks for raising this issue. We will take a look after SFN.