pynwb icon indicating copy to clipboard operation
pynwb copied to clipboard

pynwb-validate does not detect missing timezone in datetime objects

Open h-mayorquin opened this issue 7 months ago • 1 comments

Related to this issue in dandi-cli and this one in nwbinspector, both within the ecosystem:

A user created a file in MATLAB using datetime objects, but without specifying a timezone. When they tried to upload the file to DANDI, the upload failed. They reported that they had used pynwb-validate to check for errors and found none. I was able to reproduce the issue using their file:

pynwb-validate P22_1120_FBL_04272014_2.nwb
Validating P22_1120_FBL_04272014_2.nwb against cached namespace information using namespace 'core'.
 - no errors found.

However, the file fails validation with nwbinspector and also cannot be opened using PyNWB 3.0.

Two questions:

  1. Is this a bug or limitation in pynwb-validate?
  2. Now that the inspector handles more comprehensive validation, should we reduce the prominence of pynwb-validate to avoid confusion? According to the PyNWB validation documentation, it seems that nwbinspector covers everything pynwb-validate does and more. Is there still a reason to keep pynwb-validate visible in the documentation? Perhaps it would be better to only link to the inspector to prevent misunderstandings.

h-mayorquin avatar May 26 '25 22:05 h-mayorquin

I discussed this topic with @rly in our triage meeting today. There are a couple of issues here:

Is this a bug or limitation in pynwb-validate?

This seems to be a bug in the HDMF validator, we think pynwb-validate should catch the missing timezone information.

A user created a file in MATLAB using datetime objects, but without specifying a timezone. When they tried to upload the file to DANDI, the upload failed.

Is this an older file or does MatNWB currently allow datetimes to be created without time zone information? If so it may be good to add a check for that.

Now that the inspector handles more comprehensive validation, should we reduce the prominence of pynwb-validate to avoid confusion? According to the PyNWB validation documentation, it seems that nwbinspector covers everything pynwb-validate does and more. Is there still a reason to keep pynwb-validate visible in the documentation? Perhaps it would be better to only link to the inspector to prevent misunderstandings.

We recently added the note to the start of the validation example and the CLI documentation to encourage users to use NWBInspector instead, but I'm not sure if that was sufficient. It may be helpful to add some additional context that NWBInspector will be what is ultimately used for file validation when uploading to DANDI. I'm not sure about removing this example entirely from the documentation since I think it is helpful to demonstrate its usage, but I am curious what others think.

stephprince avatar May 29 '25 22:05 stephprince