# xarray.auto_combine

`xarray.``auto_combine`(datasets, concat_dim='__infer_concat_dim__', compat='no_conflicts', data_vars='all', coords='different')

  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 sort data under any circumstances. It does align coordinates, but different variables on datasets can cause it to fail under some scenarios. In complex cases, you may need to clean up your data and use `concat`/`merge` explicitly.

  `auto_combine` works well if you have N years of data and M data variables, and each combination of a distinct time period and set of data variables is saved its own dataset.

  Parameters:

  datasets : sequence of xarray.Dataset

  > Dataset objects to merge.

  concat_dim : str or DataArray or Index, optional

  > Dimension along which to concatenate variables, as used by `xarray.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. By default, xarray attempts to infer this argument by examining component files. Set `concat_dim=None` explicitly to disable concatenation.

  compat : {‘identical’, ‘equals’, ‘broadcast_equals’,

  > > ‘no_conflicts’}, optional

  > String indicating how to compare variables of the same name for potential conflicts:

  > - ‘broadcast_equals’: all values must be equal when variables are broadcast against each other to ensure common dimensions.
  > - ‘equals’: all values and dimensions must be the same.
  > - ‘identical’: all values, dimensions and attributes must be the same.
  > - ‘no_conflicts’: only values which are not null in both datasets must be equal. The returned dataset then contains the combination of all non-null values.

  data_vars : {‘minimal’, ‘different’, ‘all’ or list of str}, optional

  > Details are in the documentation of concat

  coords : {‘minimal’, ‘different’, ‘all’ o list of str}, optional

  > Details are in the documentation of concat

  Returns: | combined : xarray.Dataset

  See also

  `concat`, `Dataset.merge`