cf.Domain.get_data_axes

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

Return the keys of the domain axis constructs spanned by the data of a metadata construct.

New in version 3.11.0.

Parameters
identity: optional

Select the construct by one of

  • A metadata construct identity.

    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 metadata construct

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

Parameter example:

identity='latitude'

Parameter example:

``identity=’T’

Parameter example:

identity='long_name=Cell Area'

Parameter example:

identity='cellmeasure1'

Parameter example:

identity='measure:area'

Parameter example:

identity=cf.eq('time')'

Parameter example:

identity=re.compile('^lat')

default: optional

Return the value of the default parameter if the data axes have not been set.

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

Returns
tuple

The keys of the domain axis constructs spanned by the data.

Examples

>>> d = cf.example_field(7).domain
>>> print(d)
Dimension coords: time(3) = [1979-05-01 12:00:00, 1979-05-02 12:00:00, 1979-05-03 12:00:00] gregorian
                : air_pressure(1) = [850.0] hPa
                : grid_latitude(4) = [0.44, ..., -0.88] degrees
                : grid_longitude(5) = [-1.18, ..., 0.58] degrees
Auxiliary coords: latitude(grid_latitude(4), grid_longitude(5)) = [[52.4243, ..., 51.1163]] degrees_north
                : longitude(grid_latitude(4), grid_longitude(5)) = [[8.0648, ..., 10.9238]] degrees_east
Coord references: grid_mapping_name:rotated_latitude_longitude
>>> print(d.constructs)
Constructs:
{'auxiliarycoordinate0': <CF AuxiliaryCoordinate: latitude(4, 5) degrees_north>,
 'auxiliarycoordinate1': <CF AuxiliaryCoordinate: longitude(4, 5) degrees_east>,
 'coordinatereference0': <CF CoordinateReference: grid_mapping_name:rotated_latitude_longitude>,
 'dimensioncoordinate0': <CF DimensionCoordinate: time(3) days since 1979-1-1 gregorian>,
 'dimensioncoordinate1': <CF DimensionCoordinate: air_pressure(1) hPa>,
 'dimensioncoordinate2': <CF DimensionCoordinate: grid_latitude(4) degrees>,
 'dimensioncoordinate3': <CF DimensionCoordinate: grid_longitude(5) degrees>,
 'domainaxis0': <CF DomainAxis: size(3)>,
 'domainaxis1': <CF DomainAxis: size(1)>,
 'domainaxis2': <CF DomainAxis: size(4)>,
 'domainaxis3': <CF DomainAxis: size(5)>}
>>> d.get_data_axes('grid_latitude')
('domainaxis2',)
>>> d.get_data_axes('latitude')
('domainaxis2', 'domainaxis3')