cf.Data.__contains__

Data.__contains__(value)[source]

Membership test operators

x.__contains__(y) <==> y in x

Returns True if the value is contained anywhere in the data array. The value may be a cf.Data object.

Examples

>>> d = cf.Data([[0.0, 1,  2], [3, 4, 5]], units='m')
>>> 4 in d
True
>>> cf.Data(3) in d
True
>>> value = d[1, 2]
>>> value.Units *= 2
>>> value.squeeze(0)
>>> value
<CF Data: [2.5] 2 m>
>>> value in d
True
>>> numpy.array([[[2]]]) in d
True

Previous topic

cf.Data.__setitem__

Next topic

cf.Data.__repr__

This Page