cf.Domain.domain_axis_key

Domain.domain_axis_key(identity, default=ValueError())[source]

Return the key of the domain axis construct that is spanned by 1-d coordinate constructs.

Parameters
identity:

Select the 1-d coordinate constructs that have the given identity.

An identity is specified by a string (e.g. 'latitude', 'long_name=time', etc.); or a compiled regular expression (e.g. re.compile('^atmosphere')), for which all constructs whose identities match (via re.search) are selected.

Each coordinate construct has a number of identities, and is selected if any of them match any of those provided. A construct’s identities are those returned by its identities method. In the following example, the construct x has four identities:

>>> x.identities()
['time', 'long_name=Time', 'foo=bar', 'ncvar%T']

In addition, each construct also has an identity based its construct key (e.g. 'key%dimensioncoordinate2')

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

default: optional

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

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

Returns
str

The key of the domain axis construct that is spanned by the data of the selected 1-d coordinate constructs.

Examples:

>>> print(f.constructs())
Constructs:
{'dimensioncoordinate0': <DimensionCoordinate: time(1) days since 1964-01-21 00:00:00 >,
 'dimensioncoordinate1': <DimensionCoordinate: pressure(23) mbar>,
 'dimensioncoordinate2': <DimensionCoordinate: latitude(160) degrees_north>,
 'dimensioncoordinate3': <DimensionCoordinate: longitude(320) degrees_east>,
 'domainaxis0': <DomainAxis: size(1)>,
 'domainaxis1': <DomainAxis: size(23)>,
 'domainaxis2': <DomainAxis: size(160)>,
 'domainaxis3': <DomainAxis: size(320)>}
>>> f.domain.domain_axis_key('time')
'domainaxis0'
>>> f.domain.domain_axis_key('longitude')
'domainaxis3'