cf.Domain.dimension_to_auxiliary

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

Move dimension coordinates to an auxiliary coordinate construct.

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

New in version 3.14.1.

Parameters
identity, filter_kwargs: optional

Select the unique dimension coordinate construct returned by f.dimension_coordinate(*identity, **filter_kwargs). See dimension_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 auxiliary 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