Don't remove mask on no-mask masked arrays#2856
Conversation
|
Surprised this behaviour isn't tested... |
|
Relates to #2046. |
DPeterK
left a comment
There was a problem hiding this comment.
@djkirkham these changes definitely need some testing associated with them...
Thanks for taking this on though!
| result = scipy.stats.mstats.mquantiles(data, quantiles, axis=-1, | ||
| **kwargs) | ||
| if not ma.isMaskedArray(data) and not ma.is_masked(result): | ||
| result = np.asarray(result) |
There was a problem hiding this comment.
I've reinstated this check since the cube is constructed in this method, and the guard only causes it to be unmasked if the input data was not a masked array, which seems sensible.
| fullcube_data[slice_indices_tuple] = data | ||
|
|
||
| # Remove the data mask if completely unused. | ||
| if not np.ma.is_masked(fullcube_data): |
There was a problem hiding this comment.
This array is constructed as a masked array at line 223, so if we don't convert it to an ndarray it will output a masked array even if the input is an ndarray.
|
I've reinstated some of the checks I removed. See my comments on commit f63d950 |
|
LGTM. I'll cross-check the behaviour and ensure there is an appropriate what's new entry. |
|
Just to confirm that as a result of this PR, the behaviour is unchanged between iris 1.13 and 2.0. Code to confirm: |
Replaces #1575
Removes all instances of checking if a MaskedArray has no mask and replacing it with an ndarray.