cf.Field.coordinate_reference¶
-
Field.
coordinate_reference
(*identity, default=ValueError(), key=False, item=False, **filter_kwargs)[source]¶ Return a coordinate reference construct, or its key.
New in version (cfdm): 1.10.0.0
See also
- Parameters
- identity: optional
Select coordinate reference constructs that have an identity, defined by their
identities
methods, that matches any of the given values.Additionally, the values are matched against construct identifiers, with or without the
'key%'
prefix.If no identities are provided then all coordinate reference constructs are selected.
A value may be any object that can match via the
==
operator, or are.Pattern
object that matches via itssearch
method.Note that in the output of a
dump
method orprint
call, a construct is always described by an identity that will select it.- key:
bool
, optional If True then return the selected construct identifier. By default the construct itself is returned.
- item:
bool
, optional If True then return the selected construct identifier and the construct itself. By default the construct itself is returned. If key is True then item is ignored.
- default: optional
Return the value of the default parameter if there is no unique construct.
If set to an
Exception
instance then it will be raised instead.- filter_kwargs: optional
Keyword arguments as accepted by
Constructs.filter
that define additional construct selection criteria.
- Returns
The selected construct, or its identifier if key is True, or a tuple of both if item is True.
Examples
>>> f = cf.example_field(1) >>> f.coordinate_reference('grid_mapping_name:rotated_latitude_longitude') <CoordinateReference: grid_mapping_name:rotated_latitude_longitude> >>> f.coordinate_reference('grid_mapping_name:rotated_latitude_longitude', key=True) 'coordinatereference1' >>> f.coordinate_reference('grid_mapping_name:rotated_latitude_longitude', item=True) ('coordinatereference1', <CoordinateReference: grid_mapping_name:rotated_latitude_longitude>)