uwacan.concatenate#
- concatenate(items, dim=None, nan_between_items=False, sort=False, cls=None, **kwargs)[source]#
Concatenates a list of items along a specified dimension.
- Parameters:
- itemslist of
xarray.Datasetorxarray.DataArrayorxrwrap A list of items to be concatenated. The items can be
xr.Dataset,xr.DataArray, or instances of a subclass ofxrwrap. Mostuwacandata wrappers are compatible.- dimstr or None, optional
The dimension along which to concatenate. If
None, the function will attempt to infer the dimension from the first item. If the items have more than one dimension, aValueErrorwill be raised. The concatenation dimension can be an existing dim or a new dim.- nan_between_itemsbool, optional, default=False
If
True, inserts NaN values between concatenated items along the specified dimension. This is useful for visualization purposes, as it makes most plotting libraries split the lines.- sortbool, optional, default=False
If
True, sorts the concatenated items by the specified dimension.- clsclass or callable, optional
The class or callable to use for wrapping the concatenated result. If
None, the function will try to infer the class from the first item. Ifclsis a subclass ofxrwrapand has afrom_datasetmethod, it will use that method to wrap the result.- **kwargsdict
Additional keyword arguments passed to the class or callable specified by
clswhen wrapping the concatenated result.
- itemslist of
- Returns:
- object
The concatenated object, either as an
xr.Dataset,xr.DataArray, or as an instance of the specifiedcls(or inferred class).