You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two Metadata objects with identical attributes will compare not equal if they both have NaN for a fill_value. This is because the __eq__ check introspects deeper until it finds e.g. the np.float32(nan) type, but
In [4]: bool(np.float32('nan') ==np.float32('nan'))
Out[4]: False
The solution needs to be to actually check two Metadata classes are __eq__ with dedicated code, not just trusting the python dataclasses' automatically-generated __eq__ method to do it correctly.
Zarr version
main
Numcodecs version
n/a
Python Version
3.12
Operating System
linux
Installation
pip editable
Description
Two
Metadata
objects with identical attributes will compare not equal if they both haveNaN
for afill_value
. This is because the__eq__
check introspects deeper until it finds e.g. thenp.float32(nan)
type, but(See https://stackoverflow.com/a/10059796 for why numpy NaNs behave like this.)
The solution needs to be to actually check two
Metadata
classes are__eq__
with dedicated code, not just trusting the python dataclasses' automatically-generated__eq__
method to do it correctly.xref zarr-developers/VirtualiZarr#501
Steps to reproduce
Additional output
No response
The text was updated successfully, but these errors were encountered: