Skip to content

[Bug]: Python float attributes not valid against float64 spec #1368

@rly

Description

@rly

What happened?

Zarr attributes fail to validate against an attribute spec with dtype=float64. This is because Zarr reads the attributes (in .zattrs, a JSON file), as Python-native float, and the HDMF validator reads float values as dtype="float" which in HDMF aliases to float32. This is incorrect because Python-native floats are 64-bit.

Similarly, Python-native int has unlimited precision and so should be aliased to int64, not int32.

NWBHDF5IO/h5py reads scalars as numpy objects with numpy dtypes so this is not an issue there.

I believe this issue would also come up when validating in-memory, unwritten files.

This is blocking validation of some Allen Institute zarr files that have an extension with an attribute with float64 dtype.

Steps to Reproduce

...

Traceback

Operating System

Windows

Python Version

3.13

Package Versions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    category: bugerrors in the code or code behaviorpriority: mediumnon-critical problem and/or affecting only a small set of users

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions