Mask an array where less than or equal to a given value. This function is a shortcut to ``masked_where``, with `condition` = (x <= value). See Also -------- masked_where : Mask where a condition is met. Examples -------- >>> import numpy.ma as ma >>> a = n
(x, value, copy=True)
| 2026 | |
| 2027 | |
| 2028 | def masked_less_equal(x, value, copy=True): |
| 2029 | """ |
| 2030 | Mask an array where less than or equal to a given value. |
| 2031 | |
| 2032 | This function is a shortcut to ``masked_where``, with |
| 2033 | `condition` = (x <= value). |
| 2034 | |
| 2035 | See Also |
| 2036 | -------- |
| 2037 | masked_where : Mask where a condition is met. |
| 2038 | |
| 2039 | Examples |
| 2040 | -------- |
| 2041 | >>> import numpy.ma as ma |
| 2042 | >>> a = np.arange(4) |
| 2043 | >>> a |
| 2044 | array([0, 1, 2, 3]) |
| 2045 | >>> ma.masked_less_equal(a, 2) |
| 2046 | masked_array(data=[--, --, --, 3], |
| 2047 | mask=[ True, True, True, False], |
| 2048 | fill_value=999999) |
| 2049 | |
| 2050 | """ |
| 2051 | return masked_where(less_equal(x, value), x, copy=copy) |
| 2052 | |
| 2053 | |
| 2054 | def masked_not_equal(x, value, copy=True): |