xarray.DataTree.filter_like#
- DataTree.filter_like(other)[source]#
Filter a datatree like another datatree.
Returns a new tree containing only the nodes in the original tree which are also present in the other tree.
See also
Examples
>>> dt = DataTree.from_dict( ... { ... "/a/A": None, ... "/a/B": None, ... "/b/A": None, ... "/b/B": None, ... } ... ) >>> other = DataTree.from_dict( ... { ... "/a/A": None, ... "/b/A": None, ... } ... ) >>> dt.filter_like(other) <xarray.DataTree> Group: / ├── Group: /a │ └── Group: /a/A └── Group: /b └── Group: /b/A