datatree/datatree.py
def _init_single_datatree_node(
        cls,
        name: Hashable,
        data: Union[Dataset, DataArray] = None,
        parent: TreeNode = None,
        children: List[TreeNode] = None,
    ):
        """
        Create a single node of a DataTree, which optionally contains data in the form of an xarray.Dataset.

        Parameters
        ----------
        name : Hashable
            Name for the root node of the tree. Default is "root"
        data : Dataset, DataArray, Variable or None, optional
            Data to store under the .ds attribute of this node. DataArrays and Variables will be promoted to Datasets.
            Default is None.
        parent : TreeNode, optional
            Parent node to this node. Default is None.
        children : Sequence[TreeNode], optional
            Any child nodes of this node. Default is None.

        Returns
        -------
        node :  DataTree
        """

        # This approach was inspired by xarray.Dataset._construct_direct()
        obj = object.__new__(cls)
        obj = _init_single_treenode(obj, name=name, parent=parent, children=children)
        obj.ds = data

        obj._add_all_dataset_api()

        return obj

        Create a single node of a DataTree, which optionally contains data in the form of an xarray.Dataset.

        Parameters
        ----------
        name : Hashable
            Name for the root node of the tree. Default is "root"
        data : Dataset, DataArray, Variable or None, optional
            Data to store under the .ds attribute of this node. DataArrays and Variables will be promoted to Datasets.
            Default is None.
        parent : TreeNode, optional
            Parent node to this node. Default is None.
        children : Sequence[TreeNode], optional
            Any child nodes of this node. Default is None.

        Returns
        -------
        node :  DataTree
        
Create a single node of a DataTree, which optionally contains data in the form of an xarray.Dataset.
Parameters

name : Hashable
Name for the root node of the tree. Default is "root"
data : Dataset, DataArray, Variable or None, optional
Data to store under the .ds attribute of this node. DataArrays and Variables will be promoted to Datasets.
Default is None.
parent : TreeNode, optional
Parent node to this node. Default is None.
children : Sequence[TreeNode], optional
Any child nodes of this node. Default is None.

Returns


Create a single node of a DataTree which optionally contains data in the form of an xarray . Dataset . Parameters name : Hashable Name for the root node of the tree . Default is " root " data : Dataset DataArray Variable or None optional Data to store under the . ds attribute of this node . DataArrays and Variables will be promoted to Datasets . Default is None . parent : TreeNode optional Parent node to this node . Default is None . children : Sequence [ TreeNode ] optional Any child nodes of this node . Default is None . Returns
def _init_single_datatree_node(
        cls,
        name: Hashable,
        data: Union[Dataset, DataArray] = None,
        parent: TreeNode = None,
        children: List[TreeNode] = None,
    ):
        obj = object.__new__(cls)
        obj = _init_single_treenode(obj, name=name, parent=parent, children=children)
        obj.ds = data
        obj._add_all_dataset_api()
        return obj
def _init_single_datatree_node ( cls , name : Hashable , data : Union [ Dataset , DataArray ] = None , parent : TreeNode = None , children : List [ TreeNode ] = None , ) : obj = object . __new__ ( cls ) obj = _init_single_treenode ( obj , name = name , parent = parent , children = children ) obj . ds = data obj . _add_all_dataset_api ( ) return obj
Create a single node of a DataTree, which optionally contains data in the form of an xarray.Dataset.
Create a single node of a DataTree which optionally contains data in the form of an xarray . Dataset .
"""
        Create a single node of a DataTree, which optionally contains data in the form of an xarray.Dataset.

        Parameters
        ----------
        name : Hashable
            Name for the root node of the tree. Default is "root"
        data : Dataset, DataArray, Variable or None, optional
            Data to store under the .ds attribute of this node. DataArrays and Variables will be promoted to Datasets.
            Default is None.
        parent : TreeNode, optional
            Parent node to this node. Default is None.
        children : Sequence[TreeNode], optional
            Any child nodes of this node. Default is None.

        Returns
        -------
        node :  DataTree
        """ # This approach was inspired by xarray.Dataset._construct_direct()
cls
name
Hashable
data
Union[Dataset, DataArray]
parent
TreeNode
children
List[TreeNode]