xray.auto_combine(datasets, concat_dim=None)

Attempt to auto-magically combine the given datasets into one.

This method attempts to combine a list of datasets into a single entity by inspecting metadata and using a combination of concat and merge.

It does not concatenate along more than one dimension or align or sort data under any circumstances. It will fail in complex cases, for which you should use concat and merge explicitly.

When auto_combine may succeed:

  • You have N years of data and M data variables. Each combination of a distinct time period and test of data variables is saved its own dataset.

Examples of when auto_combine fails:

  • In the above scenario, one file is missing, containing the data for one year’s data for one variable.
  • In the most recent year, there is an additional data variable.
  • Your data includes “time” and “station” dimensions, and each year’s data has a different set of stations.

datasets : sequence of xray.Dataset

Dataset objects to merge.

concat_dim : str or DataArray or Index, optional

Dimension along which to concatenate variables, as used by xray.concat(). You only need to provide this argument if the dimension along which you want to concatenate is not a dimension in the original datasets, e.g., if you want to stack a collection of 2D arrays along a third dimension.


combined : xray.Dataset

See also

concat, Dataset.merge