cf.Data.hardmask¶
-
Data.hardmask¶ Hardness of the mask.
If the
hardmaskattribute 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
hardmaskattribute isFalse, i.e. there is a soft mask, then masked entries may be overwritten with non-missing values.Note
Setting the
hardmaskattribute 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_maskandsoften_maskmethods immediately reset the mask hardness of the underlyingdaskarray, and also set the value of thehardmaskattribute.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]