cf.CoordinateReference.change_coord

CoordinateReference.change_coord(value, new=None)[source]

Change a link to a dimension or auxiliary coordinate object.

If no new value is specified the coordinate object is unlinked from the coordinate reference.

Parameters:
value : str

The existing identifier to a linked dimension or auxiliary coordinate object.

new : str, optional

The new identifier for the coordinate. By default the coordinate object is unlinked from the coordinate reference.

Returns:

None

Examples:
>>> c = cf.CoordinateReference('atmosphere_hybrid_height_coordinate',
...                             coord_terms=['a', 'b'],
...                             a='ncvar:ak',
...                             b='ncvar:bk')
>>> c.coords
{'atmosphere_hybrid_height_coordinate', 'ncvar:ak', 'ncvar:bk'}
>>> c.items()
[('a', 'ncvar:ak'), ('b', 'ncvar:bk')]
>>> c.change_coord('ncvar:ak', 'long_name:ak')
>>> c.coords
{'atmosphere_hybrid_height_coordinate', 'long_name:ak', 'ncvar:bk'}
>>> c.items()
[('a', 'long_name:ak'), ('b', 'ncvar:bk')]

Previous topic

cf.CoordinateReference.Z

Next topic

cf.CoordinateReference.close

This Page