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
With the release of numpy 2.0 adopting NEP 50 by default, type promotion has changed and any attempts to coerce python scalar values into data types that can't represent that value now raise an OverflowError.
Before, if you had a dtype of uint8 the fill value would wind up being 241 after overflowing.
I recommend creating a more sophisticated mapping of appropriate fill values based on dtypes:
uint8 - 255
int8 - -128
...
float32 - nan
float64 - nan
datetime64 - nan (depends on context... numpy supported contexts are NaT, float-only contexts would be NaN)
I'll try to take a look at a PR if I can find the time.
The text was updated successfully, but these errors were encountered:
https://numpy.org/neps/nep-0050-scalar-promotion.html#nep50
pocean-core/pocean/utils.py
Line 305 in acd977b
pocean-core/pocean/cf.py
Line 14 in acd977b
With the release of numpy 2.0 adopting NEP 50 by default, type promotion has changed and any attempts to coerce python scalar values into data types that can't represent that value now raise an
OverflowError
.Before, if you had a dtype of
uint8
the fill value would wind up being241
after overflowing.I recommend creating a more sophisticated mapping of appropriate fill values based on dtypes:
uint8
-255
int8
--128
float32
-nan
float64
-nan
datetime64
-nan
(depends on context... numpy supported contexts are NaT, float-only contexts would be NaN)I'll try to take a look at a PR if I can find the time.
The text was updated successfully, but these errors were encountered: