datatree.DataTree.filter

Attention

This repository has been archived. Please use xarray.DataTree instead.

datatree.DataTree.filter#

DataTree.filter(filterfunc: Callable[[DataTree], bool]) DataTree[source][source]#

Filter nodes according to a specified condition.

Returns a new tree containing only the nodes in the original tree for which fitlerfunc(node) is True. Will also contain empty nodes at intermediate positions if required to support leaves.

Parameters:

filterfunc (function) – A function which accepts only one DataTree - the node on which filterfunc will be called.

Returns:

DataTree