cf.Variable.setmask

Variable.setmask(value, indices=Ellipsis)[source]

Set selected elements of the data array’s mask in place.

The value to which the selected elements of the mask will be set may be any object which is broadcastable across the selected elements. The broadcasted value may be of any data type but will be evaluated as boolean.

Unmasked elements are set to the fill value.

The mask may be effectively removed by setting every element to False with f.setmask(False).

Note that if and only if the value to be assigned is logically scalar and evaluates to True then f.setmask(value, indices) is equivalent to f.setitem(cf.masked, indices). This is consistent with the behaviour of numpy masked arrays.

Parameters :
value : array-like

The value to which the selected element s of the mask will be set. Must be an object which is broadcastable across the selected elements.

indices : optional

Indices of the data array. Only elements of the mask described by the indices are set to value. By default, the entire mask is considered.

Returns :

None

Examples

Previous topic

cf.Variable.setitem

Next topic

cf.Variable.setprop

This Page