cf.Field.getprop

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

Get a CF property.

When a default argument is given, it is returned when the attribute doesn’t exist; without it, an exception is raised in that case.

See also

delprop, hasprop, setprop

Examples 1:
>>> f.getprop('standard_name')
Parameters:
prop: str

The name of the CF property.

default: optional

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

Returns:
out:

The value of the named property or the default value, if set.

Examples 2:
>>> f.getprop('standard_name')
>>> f.getprop('standard_name', None)
>>> f.getprop('foo')
AttributeError: Field doesn't have CF property 'foo'
>>> f.getprop('foo', 'bar')
'bar'