cf.Data.__contains__

Data.__contains__(value)[source]

Membership test operator in

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]], 'm')
>>> 4 in d
True
>>> cf.Data(3) in d
True
>>> cf.Data([2.5], units='2 m') in d
True
>>> [[2]] in d
True
>>> numpy.array([[[2]]]) in d
True
>>> cf.Data(2, 'seconds') in d
False

Previous topic

cf.Data.__setitem__

Next topic

cf.Data.__repr__

This Page