xarray.DataTree (original) (raw)

A tree-like hierarchical collection of xarray objects.

Attempts to present an API like that of xarray.Dataset, but methods are wrapped to also update all the tree’s child nodes.

__init__([dataset, children, name]) Create a single node of a DataTree.
all([dim, keep_attrs]) Reduce this DataTree's data by applying all along some dimension(s).
any([dim, keep_attrs]) Reduce this DataTree's data by applying any along some dimension(s).
argsort([axis, kind, order]) Returns the indices that would sort this array.
assign([items]) Assign new data variables or child nodes to a DataTree, returning a new object with all the original items in addition to the new ones.
chunk([chunks, name_prefix, token, lock, ...]) Coerce all arrays in all groups in this tree into dask arrays with the given chunks.
close() Close any files associated with this tree.
compute(**kwargs) Manually trigger loading and/or computation of this datatree's data from disk or a remote source into memory and return a new datatree.
conj() Complex-conjugate all elements.
conjugate() Return the complex conjugate, element-wise.
copy(*[, inherit, deep]) Returns a copy of this subtree.
count([dim, keep_attrs]) Reduce this DataTree's data by applying count along some dimension(s).
cumprod([dim, skipna, keep_attrs]) Reduce this DataTree's data by applying cumprod along some dimension(s).
cumsum([dim, skipna, keep_attrs]) Reduce this DataTree's data by applying cumsum along some dimension(s).
drop_nodes(names, *[, errors]) Drop child nodes from this node.
equals(other) Two DataTrees are equal if they have isomorphic node structures, with matching node names, and if they have matching variables and coordinates, all of which are equal.
filter(filterfunc) Filter nodes according to a specified condition.
filter_like(other) Filter a datatree like another datatree.
find_common_ancestor(other) Find the first common ancestor of two nodes in the same tree.
from_dict(d, /[, name]) Create a datatree from a dictionary of data objects, organised by paths into the tree.
get(key[, default]) Access child nodes, variables, or coordinates stored in this node.
identical(other) Like equals, but also checks attributes on all datasets, variables and coordinates, and requires that any inherited coordinates at the tree root are also inherited on the other tree.
isel([indexers, drop, missing_dims]) Returns a new data tree with each array indexed along the specified dimension(s).
isomorphic(other) Two DataTrees are considered isomorphic if the set of paths to their descendent nodes are the same.
items()
iter_lineage() Iterate up the tree, starting from the current node.
keys()
load(**kwargs) Manually trigger loading and/or computation of this datatree's data from disk or a remote source into memory and return this datatree.
map_over_datasets(func, *args[, kwargs]) Apply a function to every dataset in this subtree, returning a new tree which stores the results.
match(pattern) Return nodes with paths matching pattern.
max([dim, skipna, keep_attrs]) Reduce this DataTree's data by applying max along some dimension(s).
mean([dim, skipna, keep_attrs]) Reduce this DataTree's data by applying mean along some dimension(s).
median([dim, skipna, keep_attrs]) Reduce this DataTree's data by applying median along some dimension(s).
min([dim, skipna, keep_attrs]) Reduce this DataTree's data by applying min along some dimension(s).
orphan() Detach this node from its parent.
persist(**kwargs) Trigger computation, keeping data as chunked arrays.
pipe(func, *args, **kwargs) Apply func(self, *args, **kwargs)
prod([dim, skipna, min_count, keep_attrs]) Reduce this DataTree's data by applying prod along some dimension(s).
reduce(func[, dim, keep_attrs, keepdims, ...]) Reduce this tree by applying func along some dimension(s).
relative_to(other) Compute the relative path from this node to node other.
round(*args, **kwargs)
same_tree(other) True if other node is in the same tree as this node.
sel([indexers, method, tolerance, drop]) Returns a new data tree with each array indexed by tick labels along the specified dimension(s).
set_close(close) Set the closer for this node.
std([dim, skipna, ddof, keep_attrs]) Reduce this DataTree's data by applying std along some dimension(s).
sum([dim, skipna, min_count, keep_attrs]) Reduce this DataTree's data by applying sum along some dimension(s).
to_dataset([inherit]) Return the data in this node as a new xarray.Dataset object.
to_dict([relative]) Create a dictionary mapping of paths to the data contained in those nodes.
to_netcdf(filepath[, mode, encoding, ...]) Write datatree contents to a netCDF file.
to_zarr(store[, mode, encoding, ...]) Write datatree contents to a Zarr store.
update(other) Update this node's children and / or variables.
values()
var([dim, skipna, ddof, keep_attrs]) Reduce this DataTree's data by applying var along some dimension(s).
ancestors All parent nodes and their parent nodes, starting with the most distant.
attrs Dictionary of global attributes on this node object.
children Child nodes of this node, stored under a mapping via their names.
chunksizes Mapping from group paths to a mapping of chunksizes.
coords Dictionary of xarray.DataArray objects corresponding to coordinate variables
data_vars Dictionary of DataArray objects corresponding to data variables
dataset An immutable Dataset-like view onto the data in this node.
depth Maximum level of this tree.
descendants Child nodes and all their child nodes.
dims Mapping from dimension names to lengths.
ds An immutable Dataset-like view onto the data in this node.
encoding Dictionary of global encoding attributes on this node object.
groups Return all groups in the tree, given as a tuple of path-like strings.
has_attrs Whether or not there are any metadata attributes in this node.
has_data Whether or not there are any variables in this node.
indexes Mapping of pandas.Index objects used for label based indexing.
is_empty False if node contains any data or attrs.
is_hollow True if only leaf nodes contain data.
is_leaf Whether this node is a leaf node.
is_root Whether this node is the tree root.
leaves All leaf nodes.
level Level of this node.
lineage All parent nodes and their parent nodes, starting with the closest.
name The name of this node.
nbytes
parent Parent of this node.
parents All parent nodes and their parent nodes, starting with the closest.
path Return the file-like path from the root to this node.
root Root node of the tree
siblings Nodes with the same parent as this node.
sizes Mapping from dimension names to lengths.
subtree Iterate over all nodes in this tree, including both self and all descendants.
subtree_with_keys Iterate over relative paths and node pairs for all nodes in this tree.
variables Low level interface to node contents as dict of Variable objects.
width Number of nodes at this level in the tree.
xindexes Mapping of xarray Index objects used for label based indexing.