cf.Field.getattr

Field.getattr(attr, *default)

Get a standard or non-standard CF attribute.

Parameters :
attr : str

The name of the attribute to get.

default : optional

Return default if and only if the variable does not have the named attribute.

Returns :
out :

The value of the named attribute, or the default value.

Raises :
AttributeError :

If the variable does not have the named attribute a default value has not been set.

Examples

>>> f.getattr('standard_name')
>>> f.getattr('standard_name', None)
>>> f.getattr('foo')

Previous topic

cf.Field.extract

Next topic

cf.Field.finalize

This Page