Implementation of a dependency tree.
- class satpy.dependency_tree.DependencyTree(readers, compositors, modifiers, available_only=False)¶
Structure to discover and store Dataset dependencies.
Used primarily by the Scene object to organize dependency finding. Dependencies are stored used a series of Node objects which this class is a subclass of.
Collect Dataset generating information.
Collect the objects that generate and have information about Datasets including objects that may depend on certain Datasets being generated. This includes readers, compositors, and modifiers.
Composites and modifiers are defined per-sensor. If multiple sensors are available, compositors and modifiers are searched for in sensor alphabetical order.
readers (dict) – Reader name -> Reader Object
compositors (dict) – Sensor name -> Composite ID -> Composite Object
modifiers (dict) – Sensor name -> Modifier name -> (Modifier Class, modifier options)
available_only (bool) – Whether only reader’s available/loadable datasets should be used when searching for dependencies (True) or use all known/configured datasets regardless of whether the necessary files were provided to the reader (False). Note that when
Falseloadable variations of a dataset will have priority over other known variations. Default is
Copy this node tree.
Note all references to readers are removed. This is meant to avoid tree copies accessing readers that would return incompatible (Area) data. Theoretically it should be possible for tree copies to request compositor or modifier information as long as they don’t depend on any datasets not already existing in the dependency tree.
Get a compositor.
Get a modifer.
- populate_with_keys(dataset_keys: set, query=None)¶
Populate the dependency tree.
- update_node_name(node, new_name)¶
Update ‘name’ property of a node and any related metadata.
- class satpy.dependency_tree.Tree¶
A tree implementation.
Set up the tree.
- add_child(parent, child)¶
Add a child to the tree.
- add_leaf(ds_id, parent=None)¶
Add a leaf to the tree.
Check contains when we know the exact DataID or DataQuery.
- empty_node = <Node ('__EMPTY_LEAF_SENTINEL__')>¶
Get Node when we know the exact DataID or DataQuery.
- leaves(limit_nodes_to: Optional[Iterable[DataID]] = None, unique: bool = True) → list[Node]¶
Get the leaves of the tree starting at the root.
limit_nodes_to – Limit leaves to Nodes with the names (DataIDs) specified.
unique – Only include individual leaf nodes once.
list of leaf nodes
- trunk(limit_nodes_to: Optional[Iterable[DataID]] = None, unique: bool = True, limit_children_to: Optional[Container[DataID]] = None) → list[Node]¶
Get the trunk nodes of the tree starting at this root.
limit_nodes_to – Limit searching to trunk nodes with the names (DataIDs) specified and the children of these nodes.
unique – Only include individual trunk nodes once
limit_children_to – Limit searching to the children with the specified names. These child nodes will be included in the result, but not their children.
list of trunk nodes