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
Right now the fill_value attribute of our metadata classes is a numpy scalar, or None, or a string (i think). This is problematic for comparing two metadata instances -- if the fill value is np.nan, then np.nan == np.nan is always false, even when the two values are in fact the same.
We could address this by disallowing numpy scalars for the fill_value attribute. Instead, we could use a custom scalar wrapper class that handles NaN correctly, or use a JSON-serializable form of the scalar, e.g. a string in the case of np.nan.
an alternative approach: we allow scalars, but we override __eq__ to compare the JSON form of the metadata.
This seems better to me than requiring that the fill_value attribute be JSON-serialized. If we pre-JSONify the fill value, a string array with a fill value that is the string "nan" would falsely appear to have the same fill value as a float array with a np.NaN fill value.
Right now the
fill_value
attribute of our metadata classes is a numpy scalar, orNone
, or a string (i think). This is problematic for comparing two metadata instances -- if the fill value isnp.nan
, thennp.nan == np.nan
is always false, even when the two values are in fact the same.We could address this by disallowing numpy scalars for the
fill_value
attribute. Instead, we could use a custom scalar wrapper class that handlesNaN
correctly, or use a JSON-serializable form of the scalar, e.g. a string in the case ofnp.nan
.see also: #2929
The text was updated successfully, but these errors were encountered: