xarray.auto_combine¶
-
xarray.
auto_combine
(datasets, concat_dim='_not_supplied', compat='no_conflicts', data_vars='all', coords='different', fill_value=<NA>, join='outer', from_openmfds=False)¶ Attempt to auto-magically combine the given datasets into one.
This entire function is deprecated in favour of
combine_nested
andcombine_by_coords
.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. Setconcat_dim=None
explicitly to disable concatenation.compat ({'identical', 'equals', 'broadcast_equals',) –
‘no_conflicts’, ‘override’}, 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.
’override’: skip comparing and pick variable from first dataset
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
fill_value (scalar, optional) – Value to use for newly missing values
join ({'outer', 'inner', 'left', 'right', 'exact'}, optional) –
String indicating how to combine differing indexes (excluding concat_dim) in objects
’outer’: use the union of object indexes
’inner’: 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
’exact’: instead of aligning, raise ValueError when indexes to be aligned are not equal
’override’: if indexes are of same size, rewrite indexes to be those of the first object with that dimension. Indexes for the same dimension must have the same size in all objects.
- Returns
combined
- Return type
See also