ndcube
ndcube copied to clipboard
NDCube.fill
Describe the feature
A method that allows users to replace masked data values with a custom value, an alter associated uncertainty and mask values.
Possible API:
def fill(fill_value, unmask=False, uncertainty_fill_value=None, fill_in_place=False):
"""
Replaces masked data values with input value.
Returns a new instance or alters values in place.
Parameters
----------
fill_value: `numbers.Number` or scalar `astropy.unit.Quantity`
The value to replace masked data with.
unmask: `bool`, optional
If True, the newly filled masked values are unmasked. If False, they remain masked
Default=False
uncertainty_fill_value: `numbers.Number` or scalar `astropy.unit.Quantity`, optional
The value to replace masked uncertainties with.
fill_in_place: `bool`, optional
If `True`, the masked values are filled in place. If `False`, a new instance is returned
with masked values filled. Default=False.
"""
# ...code implementation here.
Proposed solution
No response
We could call it fillna
The method should not be named just fill(), because users will assume that the entire array will be filled. The analogue in numpy.ma is filled(), but that's not a sufficiently distinctive name. I suggest fill_masked().
Reolved by #829