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
There are two probably related issues that involve a masked array 32-bit floats:
It was expected that fill_value should have the same dtype as the parent array. It depends (shown in example).
The dtype of fill_value depends on the order of getting or setting the fill_value attribute, which is also not expected.
Reproduce the code example:
importnumpyasnpprint(np.__version__)
# Example 1: the dtype of fill_value is set to float64ar1=np.ma.arange(6, dtype=np.float32)
getattr(ar1, "fill_value")
ar1.fill_value=-999.print("Example 1: {0}, {1}".format(ar1.dtype, ar1.fill_value.dtype))
# Example 1: the dtype of fill_value is set to float32ar2=np.ma.arange(6, dtype=np.float32)
ar2.fill_value=-999.print("Example 2: {0}, {1}".format(ar2.dtype, ar2.fill_value.dtype))
output:
1.23.2
Example 1: float32, float64
Example 2: float32, float32
NumPy/Python version information:
1.23.2 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0]
Note that versions as far back as NumPy 1.16.5 (included with Ubuntu) also have the same behavior, so it's not new.
The text was updated successfully, but these errors were encountered:
fails for arrays of dtype int8.
That means the user will be forced to use fill_values in the range of the specific dtype, while now there is at least one way to put values likely to be very different from the data range: is that acceptable?
Or should a better documentation of the current behavior be sufficient to solve this issue?
Or am I on a completely wrong path?
Uh oh!
There was an error while loading. Please reload this page.
Describe the issue:
There are two probably related issues that involve a masked array 32-bit floats:
fill_value
should have the same dtype as the parent array. It depends (shown in example).dtype
offill_value
depends on the order of getting or setting thefill_value
attribute, which is also not expected.Reproduce the code example:
output:
NumPy/Python version information:
Note that versions as far back as NumPy 1.16.5 (included with Ubuntu) also have the same behavior, so it's not new.
The text was updated successfully, but these errors were encountered: