Hardness of the mask.

If the hardmask attribute is True, 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 is False, i.e. there is a soft mask, then masked entries may be overwritten with non-missing values.


Setting the hardmask attribute does not immediately change the mask hardness, rather its value indicates to other methods (such as where, 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 and soften_mask methods immediately reset the mask hardness of the underlying dask array, and also set the value of the hardmask attribute.


>>> d = cf.Data([1, 2, 3])
>>> d.hardmask
>>> d[0] = cf.masked
>>> print(d.array)
[-- 2 3]
>>> d[...] = 999
>>> print(d.array)
[-- 999 999]
>>> d.hardmask = False
>>> d.hardmask
>>> d[...] = -1
>>> print(d.array)
[-1 -1 -1]