cf.Data.hardmask¶
-
Data.
hardmask
¶ Hardness of the mask.
If the
hardmask
attribute isTrue
, i.e. there is a hard mask, then unmasking an entry will silently not occur. This is the default, and prevents overwriting the mask.If the
hardmask
attribute isFalse
, i.e. there is a soft mask, then masked entries may be overwritten with non-missing values.Note
Setting the
hardmask
attribute does not immediately change the mask hardness, rather its value indicates to other methods (such aswhere
,transpose
, etc.) whether or not the mask needs hardening or softening prior to an operation being defined, and those methods will reset the mask hardness if required.By contrast, the
harden_mask
andsoften_mask
methods immediately reset the mask hardness of the underlyingdask
array, and also set the value of thehardmask
attribute.See also
Examples
>>> d = cf.Data([1, 2, 3]) >>> d.hardmask True >>> d[0] = cf.masked >>> print(d.array) [-- 2 3] >>> d[...] = 999 >>> print(d.array) [-- 999 999] >>> d.hardmask = False >>> d.hardmask False >>> d[...] = -1 >>> print(d.array) [-1 -1 -1]