xray.align(*objects, join='inner', copy=True)

Given any number of Dataset and/or DataArray objects, returns new objects with aligned indexes.

Array from the aligned objects are suitable as input to mathematical operators, because along each dimension they are indexed by the same indexes.

Missing values (if join != 'inner') are filled with NaN.


*objects : Dataset or DataArray

Objects to align.

join : {‘outer’, ‘inner’, ‘left’, ‘right’}, optional

Method for joining the indexes of the passed objects along each dimension:

  • ‘outer’: use the union of object indexes
  • ‘outer’: use the intersection of object indexes
  • ‘left’: use indexes from the first object with each dimension
  • ‘right’: use indexes from the last object with each dimension

copy : bool, optional

If copy=True, the returned objects contain all new variables. If copy=False and no reindexing is required then the aligned objects will include original variables.


aligned : same as *objects

Tuple of objects with aligned coordinates.