xray.Dataset.concat

classmethod Dataset.concat(datasets, dimension='concat_dimension', indexers=None, mode='different', concat_over=None, compat='equals')

Concatenate datasets along a new or existing dimension.

Parameters:

datasets : iterable of Dataset

Datasets to stack together. Each dataset is expected to have matching attributes, and all variables except those along the stacked dimension (those that contain “dimension” as a dimension or are listed in “concat_over”) are expected to be equal.

dimension : str or DataArray, optional

Name of the dimension to stack along. If dimension is provided as an DataArray, the name of the DataArray is used as the stacking dimension and the array is added to the returned dataset.

indexers : None or iterable of indexers, optional

Iterable of indexers of the same length as variables which specifies how to assign variables from each dataset along the given dimension. If not supplied, indexers is inferred from the length of each variable along the dimension, and the variables are stacked in the given order.

mode : {‘minimal’, ‘different’, ‘all’}, optional

Decides which variables are concatenated. Choices are ‘minimal’ in which only variables in which dimension already appears are included, ‘different’ in which all variables which are not equal (ignoring attributes) across all datasets are concatenated (as well as all for which dimension already appears), and ‘all’ for which all variables are concatenated. Default ‘different’.

concat_over : None or str or iterable of str, optional

Names of additional variables to concatenate, in which “dimension” does not already appear as a dimension.

compat : {‘equals’, ‘identical’}, optional

String indicating how to compare non-concatenated variables and dataset global attributes for potential conflicts. ‘equals’ means that all variable values and dimensions must be the same; ‘identical’ means that variable attributes and global attributes must also be equal.

Returns:

concatenated : Dataset

Concatenated dataset formed by concatenating dataset variables.

See also

DataArray.concat