xarray.core.coordinates.DatasetCoordinates.merge

DatasetCoordinates.merge(other: Coordinates) → Dataset

Merge two sets of coordinates to create a new Dataset

The method implements the logic used for joining coordinates in the result of a binary operation performed on xarray objects:

  • If two index coordinates conflict (are not equal), an exception is raised. You must align your data before passing it to this method.
  • If an index coordinate and a non-index coordinate conflict, the non- index coordinate is dropped.
  • If two non-index coordinates conflict, both are dropped.
Parameters:other (DatasetCoordinates or DataArrayCoordinates) – The coordinates from another dataset or data array.
Returns:merged – A new Dataset with merged coordinates.
Return type:Dataset