larch.DataTree#
- class DataTree(graph=None, root_node_name=None, extra_funcs=(), extra_vars=None, cache_dir=None, relationships=(), force_digitization=False, **kwargs)[source]#
Bases:
DataTree- __init__(graph=None, root_node_name=None, extra_funcs=(), extra_vars=None, cache_dir=None, relationships=(), force_digitization=False, **kwargs)[source]#
Methods
__init__([graph, root_node_name, ...])add_dataset(name, dataset[, relationships, ...])Add a new Dataset node to this DataTree.
add_items(items)add_relationship(*args, **kwargs)Add a relationship to this DataTree.
all_var_names([uniquify, _duplicated_names])altids()Access the altids coordinates as an index.
alts_mapping()alts_name_to_id()caseids()Access the caseids coordinates as an index.
contains_subspace(key)Is this named Dataset in this tree's subspaces.
copy()digitize_relationships([inplace, redigitize])Convert all label-based relationships into position-based.
dims_detail()Report on the names and sizes of dimensions in all Dataset nodes.
drop_dims(dims[, inplace, ignore_missing_dims])Drop dimensions from root Dataset node.
eval(expression[, engine, dtype, name, ...])Evaluate an expression.
eval_many(expressions, *[, engine, dtype, ...])Evaluate multiple expressions.
finditem(item[, maybe_in])get(item[, default, broadcast, coords])Access variable(s) from this tree.
get_expr(expression[, engine, allow_native, ...])Access or evaluate an expression.
get_index(dim)get_indexes([position_only, as_dict, ...])get_named_array(mangled_name)get_relationship(parent, child)get_subspace(key[, default_empty])Access named Dataset from this tree's subspaces.
idco_subtree()list_relationships()List : List all relationships defined in this tree.
merged_dataset([columns, uniquify])namespace_names()query_cases(query[, parser, engine])Return a new DataTree, with a query filter applied to the root Dataset.
replace_datasets([other, validate, redigitize])Replace one or more datasets in the nodes of this tree.
set_altnames(alt_names)Set the alternative names for this DataTree.
setup_flow(*args, **kwargs)Set up a new Flow for analysis using the structure of this DataTree.
slice_cases(*case_slice)subspaces_iter()view_relationships([fontname, fontsize])Attributes
The _altid_ dimension of the root Dataset.
ALTIDXThe _alt_idx_ dimension of the root Dataset, if defined.
CASEALTThe _casealt_ dimension of the root Dataset, if defined.
The _caseid_ dimension of the root Dataset.
CASEPTRThe _caseptr_ dimension of the root Dataset, if defined.
coordsdcdimsMapping from dimension names to lengths across all dataset nodes.
The size of the _altid_ dimension of the root Dataset.
The size of the _caseid_ dimension of the root Dataset.
Whether all relationships are digital (by position).
root_datasetroot_dimsroot_nodeThe root node for this data tree, which is only ever a parent.
root_node_name_strThe root node for this data tree, which is only ever a parent.
shapebase shape of arrays that will be loaded when using this DataTree.
sizesMapping from dimension names to lengths across all dataset nodes.
Direct access to node Dataset objects by name.
replacement_filtersFilters that are automatically applied to data on replacement.
subspace_fallbacksAllowable fallback subspace lookups.