xarray.DataArray.reindex_like

DataArray.reindex_like(other, method=None, tolerance=None, copy=True)

Conform this object onto the indexes of another object, filling in missing values with NaN.

Parameters
otherDataset or DataArray

Object with an ‘indexes’ attribute giving a mapping from dimension names to pandas.Index objects, which provides coordinates upon which to index the variables in this dataset. The indexes on this other object need not be the same as the indexes on this dataset. Any mis-matched index values will be filled in with NaN, and any mis-matched dimension names will simply be ignored.

method{None, ‘nearest’, ‘pad’/’ffill’, ‘backfill’/’bfill’}, optional

Method to use for filling index values from other not found on this data array:

  • None (default): don’t fill gaps

  • pad / ffill: propagate last valid index value forward

  • backfill / bfill: propagate next valid index value backward

  • nearest: use nearest valid index value (requires pandas>=0.16)

toleranceoptional

Maximum distance between original and new labels for inexact matches. The values of the index at the matching locations most satisfy the equation abs(index[indexer] - target) <= tolerance. Requires pandas>=0.17.

copybool, optional

If copy=True, data in the return value is always copied. If copy=False and reindexing is unnecessary, or can be performed with only slice operations, then the output may share memory with the input. In either case, a new xarray object is always returned.

Returns
reindexedDataArray

Another dataset array, with this array’s data but coordinates from the other object.