summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py14
1 files changed, 1 insertions, 13 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 313445be7..0ee630a97 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -2356,20 +2356,8 @@ def masked_invalid(a, copy=True):
fill_value=1e+20)
"""
- a = np.array(a, copy=copy, subok=True)
- mask = getattr(a, '_mask', None)
- if mask is not None:
- condition = ~(np.isfinite(getdata(a)))
- if mask is not nomask:
- condition |= mask
- cls = type(a)
- else:
- condition = ~(np.isfinite(a))
- cls = MaskedArray
- result = a.view(cls)
- result._mask = condition
- return result
+ return masked_where(~(np.isfinite(getdata(a))), a, copy=copy)
###############################################################################
# Printing options #