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.Dataset or xarray.DataArray or xrwrap

A list of items to be concatenated. The items can be xr.Dataset, xr.DataArray, or instances of a subclass of xrwrap. Most uwacan data 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, a ValueError will 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. If cls is a subclass of xrwrap and has a from_dataset method, it will use that method to wrap the result.

**kwargsdict

Additional keyword arguments passed to the class or callable specified by cls when wrapping the concatenated result.

Returns:
object

The concatenated object, either as an xr.Dataset, xr.DataArray, or as an instance of the specified cls (or inferred class).