xray.Dataset.reindex_like

Dataset.reindex_like(other, method=None, copy=True)

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

Parameters:

other : Dataset 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 in this dataset:

  • default: don’t fill gaps
  • pad / ffill: propgate last valid index value forward
  • backfill / bfill: propagate next valid index value backward
  • nearest: use nearest valid index value (requires pandas>=0.16)

copy : bool, optional

If copy=True, the returned dataset contains only copied variables. If copy=False and no reindexing is required then original variables from this dataset are returned.

Returns:

reindexed : Dataset

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