cf.Field.get_coordinate_reference

Field.get_coordinate_reference(*identity, key=False, construct=None, default=ValueError())[source]

Return a coordinate reference construct.

New in version 3.0.2.

See also

construct

Parameters
identity: optional

Select the coordinate reference construct by one of:

  • The identity of a coordinate reference construct.

    A construct has a number of string-valued identities

defined by its identities method, and is selected if any of them match the identity parameter. identity may be a string that equals one of a construct’s identities; or a re.Pattern object that matches one of a construct’s identities via re.search.

Note that in the output of a dump method or print call, a metadata construct is always described by one of its identities, and so this description may always be used as an identity value.

  • The key of a coordinate reference construct

  • None. This is the default, which selects the coordinate reference construct when there is only one of them.

Parameter example:

identity='standard_name:atmosphere_hybrid_height_coordinate'

Parameter example:

identity='grid_mapping_name:rotated_latitude_longitude'

Parameter example:

identity='transverse_mercator'

Parameter example:

identity='coordinatereference1'

Parameter example:

identity='key%coordinatereference1'

Parameter example:

identity='ncvar%lat_lon'

Parameter example:

identity=cf.eq('rotated_pole')'

Parameter example:

identity=re.compile('^rotated')

construct: optional

TODO

key: bool, optional

If True then return the selected construct key. By default the construct itself is returned.

default: optional

Return the value of the default parameter if a construct can not be found.

If set to an Exception instance then it will be raised instead.

Returns
CoordinateReference or str

The selected coordinate reference construct, or its key.

Examples