-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
np.pad applied to the MaskedArray subclass silently unmasks the array, and returns output as ndarray #8881
Comments
This is generally the case for how
As a result, many of the functions will take the approach of casting to
Short term, this is the right fix |
Ok; I guess I thought since |
I think this issue is worth keeping - some functions within So it would almost certainly be possible to pull this hack into Right now, I think the biggest problem is that |
numpy.pad can now be intercepted with |
It seems to me this should be resolved so that the
MaskedArray
subclass is preserved and themask
attribute is likewise padded --np.repeat
andnp.tile
do this, for example. I suppose I see the complication -- for masking modes likeconstant
, whether to mask these new values is ambiguous; perhaps in this case an explicit warning should be issued. But for methods that sample the edges of the existingMaskedArray
, it seems to me it would make more sense to preserve the mask; perhaps this all requires a newnp.ma.pad
module.Here is a simple example
I noticed there are several other inconsistencies here -- for example, there are
np.repeat
andnp.ma.repeat
modules that do the same thing; there is only annp.tile
method and nonp.ma.tile
method (butnp.tile
works as expected); and there is annp.concatenate
method andnp.ma.concatenate
method where the former has unexpected behavior (setsmask=False
, unmasks the data, and changesfill_value
).Perhaps I should start a more general thread on these inconsistency issues elsewhere?
The text was updated successfully, but these errors were encountered: