cf.Domain.auxiliary_to_dimension

Domain.auxiliary_to_dimension(*args, **kwargs)[source]

Move auxiliary coordinates to a dimension coordinate construct.

A new dimension coordinate construct is derived from the selected auxiliary coordinate construct, and the auxiliary coordinate construct is removed.

New in version 3.14.1.

Parameters
identity, filter_kwargs: optional

Select the unique 1-d auxiliary coordinate construct returned by f.auxiliary_coordinate(*identity, filter_by_naxes=(1,), **filter_kwargs). See auxiliary_coordinate for details.

inplace: bool, optional

If True then do the operation in-place and return None.

Returns
Domain or None

The Domain with the new dimension coordinate construct, or None if the operation was in-place.

Examples

>>> f = cf.example_field(0)
>>> print(f)
Field: specific_humidity (ncvar%q)
----------------------------------
Data            : specific_humidity(latitude(5), longitude(8)) 1
Cell methods    : area: mean
Dimension coords: latitude(5) = [-75.0, ..., 75.0] degrees_north
                : longitude(8) = [22.5, ..., 337.5] degrees_east
                : time(1) = [2019-01-01 00:00:00]
>>> g = f.dimension_to_auxiliary('latitude')
>>> print(g)
Field: specific_humidity (ncvar%q)
----------------------------------
Data            : specific_humidity(latitude(5), longitude(8)) 1
Cell methods    : area: mean
Dimension coords: longitude(8) = [22.5, ..., 337.5] degrees_east
                : time(1) = [2019-01-01 00:00:00]
Auxiliary coords: latitude(latitude(5)) = [-75.0, ..., 75.0] degrees_north
>>> h = g.auxiliary_to_dimension('latitude')
>>> print(h)
Field: specific_humidity (ncvar%q)
----------------------------------
Data            : specific_humidity(latitude(5), longitude(8)) 1
Cell methods    : area: mean
Dimension coords: latitude(5) = [-75.0, ..., 75.0] degrees_north
                : longitude(8) = [22.5, ..., 337.5] degrees_east
                : time(1) = [2019-01-01 00:00:00]
>>> h.equals(f)
True