cf.Domain.get

Domain.get(key, *default)[source]

Return the item corresponding to an internal identifier.

An item is a dimension coordinate, an auxiliary coordinate, a cell measure or a transform object.

Parameters :
key : str

An internal identifier.

default : optional

Return default if and only if the domain does not have the given key.

Returns :
out :

The item of the domain with the given internal identifier. If none exists and default is set then default is returned.

See also

has, item

Examples

>>> d.get('dim0')
<CF DimensionCoordinate: atmosphere_hybrid_height_coordinate(1)>
>>> d.get('aux1')
<CF AuxiliaryCoordinate: latitude(10, 9) degree_N>
>>> d.get('cm0')
<CF CellMeasure: area(9, 10) km 2>
>>> d.get('trans0')
<CF Transform: rotated_latitude_longitude>
>>> d.get('bad_id')
ValueError: Domain doesn't have internal identifier 'bad_id'
>>> print d.get('bad_id', None)
None

Previous topic

cf.Domain.finalize

Next topic

cf.Domain.has

This Page