cf.AncillaryVariables.getprop

AncillaryVariables.getprop(prop, *default)[source]

Return a built-in list of a CF properties from each element.

Parameters :
prop : str

The name of the property to get.

default : optional

Return default for each element that does not have the named property.

Returns :
out : list

The value of the named property, or the default value, for each element.

Raises :
AttributeError :

If any element does not have the named property and a default value has not been set.

Examples

>>> len(fl)
2
>>> fl.getprop('foo')
['bar', 'bar']
>>> fl.delprop('foo')
>>> fl.getprop('foo', 0.0)
[0.0, 0.0]

Note that recognised CF propeties (such as ‘long_name’) may be retrieved directly:

>>> fl.standard_name
['air_temperature', 'air_temperature']
>>> getattr(fl, 'long_name', 'default')
['default', 'default']

Previous topic

cf.AncillaryVariables.extend

Next topic

cf.AncillaryVariables.hasprop

This Page