cf.AncillaryVariables.hasprop

AncillaryVariables.hasprop(prop)[source]

Return a built-in list describing whether each element has a CF property.

Parameters :
prop : str

The name of the property to get.

Returns :
out : list or bools

Whether each element has the named property.

Examples

>>> len(fl)
2
>>> fl.hasprop('foo')
[False, True]

Warning: Recognised CF propeties (such as ‘long_name’) may be interrogated with the built-in hasattr, but with a different result:

>>> getattr(fl, 'standard_name', None)
['air_tmperature', None]
>>> hasattr(fl, 'standard_name')
True
>>> fl.hasprop('standard_name')
[True, False]

Previous topic

cf.AncillaryVariables.getprop

Next topic

cf.AncillaryVariables.index

This Page