The cf.masked constant allows data array values to be masked by direct assignment. This is consistent with the behaviour of numpy masked arrays.
For example, one way of masking every element of a field’s data array is:
>>> f.subspace[...] = cf.masked
To mask every element of a field’s data array whose value is less than zero:
>>> f.setdata(cf.masked, None, f<0)
See also
cf.Field.hardmask, cf.Field.setdata, cf.Field.subspace