cf.Field.setmask

Field.setmask(value, indices=Ellipsis)

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.

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

Unmasked elements are set to the fill value.

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. The broadcasted value may be of any data type but will be evaluated as boolean.

indices : optional

Select elements of the mask to be set. Either as:

  • Indices as would be accepted by f.subspace.
  • A dictionary of coordinate identifiers and conditions on their data array values as would be accepted as keyword arguments to f.indices.

Only elements of the mask described by indices are set with value. By default, the entire mask is set.

Returns :

None

Examples

Previous topic

cf.Field.setitem

Next topic

cf.Field.setprop

This Page