cf.Data.harden_mask

Data.harden_mask()[source]

Force the mask to hard.

Whether the mask of a masked array is hard or soft is determined by its hardmask property. harden_mask sets hardmask to True.

New in version 3.14.0.

See also

hardmask, soften_mask

Examples

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