mesmer.datatree.collapse_datatree_into_dataset

mesmer.datatree.collapse_datatree_into_dataset#

mesmer.datatree.collapse_datatree_into_dataset(dt, *, dim, **concat_kwargs)#

Take a DataTree and collapse all its subtrees into a single xr.Dataset along dim. Shallow wrapper around xr.concat.

All subtrees are converted to xr.Dataset objects and concatenated along the specified dimension. The dimension along which the datasets are concatenated will be added as a coordinate to the resulting dataset and the name of each subtree will be used as the coordinate value for this new dimension. Internally, xr.concat is used to concatenate the datasets, so all keyword arguments that can be passed to xr.concat can be passed to this function as well.

Parameters:
  • dt (DataTree) – The DataTree to collapse.

  • dim (str) – The dimension to concatenate the datasets along.

  • **concat_kwargs (dict) – Additional keyword arguments to pass to xr.concat.

Returns:

xr.Dataset – The collapsed dataset.