xarray.DataTree.from_dict#
- classmethod DataTree.from_dict(d, /, name=None)[source]#
Create a datatree from a dictionary of data objects, organised by paths into the tree.
- Parameters
d (dict-like) – A mapping from path names to xarray.Dataset or DataTree objects.
Path names are to be given as unix-like path. If path names containing more than one part are given, new tree nodes will be constructed as necessary.
To assign data to the root node of the tree use “”, “.”, “/” or “./” as the path.
name (
Hashable | None
, optional) – Name for the root node of the tree. Default is None.
- Returns
Notes
If your dictionary is nested you will need to flatten it before using this method.