# xarray.DataTree.to_dict

#### DataTree.to_dict(relative=False)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/datatree.py#L1490-L1510)

Create a dictionary mapping of paths to the data contained in those nodes.

* **Parameters:**
  **relative** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – If True, return relative instead of absolute paths.
* **Returns:**
  `dict[str`, `Dataset]`

#### SEE ALSO
[`DataTree.subtree_with_keys`](xarray.DataTree.subtree_with_keys.html.md#xarray.DataTree.subtree_with_keys)
