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 coordinate reference 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.
Examples: >>> d.get('dim0') <CF DimensionCoordinate: atmosphere_hybrid_height_coordinate(1)> >>> d.get('aux1') <CF AuxiliaryCoordinate: latitude(10, 9) degree_N> >>> d.get('msr0') <CF CellMeasure: area(9, 10) km 2> >>> d.get('ref0') <CF CoordinateReference: rotated_latitude_longitude> >>> d.get('bad_id') ValueError: Domain doesn't have internal identifier 'bad_id' >>> print d.get('bad_id', None) None