masked_where(condition, a)
This docstring was copied from numpy.ma.masked_where.
Some inconsistencies with the Dask version may exist.
Return a
as an array masked where :None:None:`condition`
is True. Any masked values of a
or :None:None:`condition`
are also masked in the output.
Masking condition. When :None:None:`condition`
tests floating point values for equality, consider using masked_values
instead.
Array to mask.
If True (default) make a copy of a
in the result. If False modify a
in place and return a view.
Mask an array where a condition is met.
masked_equal
Mask where equal to a given value.
masked_greater
Mask where greater than a given value.
masked_greater_equal
Mask where greater than or equal to a given value.
masked_inside
Mask inside a given interval.
masked_invalid
Mask invalid values (NaNs or infs).
masked_less
Mask where less than a given value.
masked_less_equal
Mask where less than or equal to a given value.
masked_not_equal
Mask where :None:None:`not`
equal to a given value.
masked_outside
Mask outside a given interval.
masked_values
Mask using floating point equality.
>>> import numpy.ma as ma # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... a = np.arange(4) # doctest: +SKIP
... a # doctest: +SKIP array([0, 1, 2, 3])
>>> ma.masked_where(a <= 2, a) # doctest: +SKIP masked_array(data=[--, --, --, 3], mask=[ True, True, True, False], fill_value=999999)
Mask array :None:None:`b`
conditional on a
.
>>> b = ['a', 'b', 'c', 'd'] # doctest: +SKIP
... ma.masked_where(a == 2, b) # doctest: +SKIP masked_array(data=['a', 'b', --, 'd'], mask=[False, False, True, False], fill_value='N/A', dtype='<U1')
Effect of the copy
argument.
>>> c = ma.masked_where(a <= 2, a) # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... c # doctest: +SKIP masked_array(data=[--, --, --, 3], mask=[ True, True, True, False], fill_value=999999)
>>> c[0] = 99 # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... c # doctest: +SKIP masked_array(data=[99, --, --, 3], mask=[False, True, True, False], fill_value=999999)
>>> a # doctest: +SKIP array([0, 1, 2, 3])This example is valid syntax, but we were not able to check execution
>>> c = ma.masked_where(a <= 2, a, copy=False) # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... c[0] = 99 # doctest: +SKIP
... c # doctest: +SKIP masked_array(data=[99, --, --, 3], mask=[False, True, True, False], fill_value=999999)
>>> a # doctest: +SKIP array([99, 1, 2, 3])
When :None:None:`condition`
or a
contain masked values.
>>> a = np.arange(4) # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... a = ma.masked_where(a == 2, a) # doctest: +SKIP
... a # doctest: +SKIP masked_array(data=[0, 1, --, 3], mask=[False, False, True, False], fill_value=999999)
>>> b = np.arange(4) # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... b = ma.masked_where(b == 0, b) # doctest: +SKIP
... b # doctest: +SKIP masked_array(data=[--, 1, 2, 3], mask=[ True, False, False, False], fill_value=999999)
>>> ma.masked_where(a == 3, b) # doctest: +SKIP masked_array(data=[--, 1, --, --], mask=[ True, False, True, True], fill_value=999999)See :
The following pages refer to to this document either explicitly or contain code examples using this.
dask.array.ma.masked_values
dask.array.ma.masked_invalid
dask.array.ma.masked_equal
dask.array.ma.masked_inside
dask.array.ma.masked_outside
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them