11"""
22
3- Process graph building functionality for 1.0.0-style process graphs and DataCube
4-
3+ Functionality for abstracting, building, manipulating and processing openEO process graphs.
54"""
65import abc
76import collections
@@ -23,15 +22,11 @@ def from_node(self) -> "PGNode":
2322
2423class PGNode (_FromNodeMixin ):
2524 """
26- Wrapper for process node in a process graph (has process_id and arguments).
27-
28- While this is a simple, thin container, it allows a bit more abstraction, basic encapsulation,
29- type hinting and code intelligence in your IDE than something generic like a dict.
30-
31- Also note that a full openEO "process graph" is essentially a directed acyclic graph of nodes
32- pointing to each other. A process graph is practically equivalent with its "result" node,
33- as it points (directly or recursively) to all the other nodes it depends on.
25+ A process node in a process graph: has at least a process_id and arguments.
3426
27+ Note that a full openEO "process graph" is essentially a directed acyclic graph of nodes
28+ pointing to each other. A full process graph is practically equivalent with its "result" node,
29+ as it points (directly or indirectly) to all the other nodes it depends on.
3530 """
3631
3732 def __init__ (self , process_id : str , arguments : dict = None , namespace : Union [str , None ] = None , ** kwargs ):
@@ -69,7 +64,11 @@ def namespace(self) -> Union[str, None]:
6964 return self ._namespace
7065
7166 def update_arguments (self , ** kwargs ):
72- """Change/Add/Update arguments of the process node"""
67+ """
68+ Add/Update arguments of the process node.
69+
70+ .. versionadded:: 0.10.1
71+ """
7372 self ._arguments = {** self ._arguments , ** kwargs }
7473
7574 def _as_tuple (self ):
@@ -102,7 +101,7 @@ def _deep_copy(x):
102101 return _deep_copy (self )
103102
104103 def flat_graph (self ) -> dict :
105- """Get the process graph in flat dict representation"""
104+ """Get the process graph in flat dict representation. """
106105 return GraphFlattener ().flatten (node = self )
107106
108107 flatten = legacy_alias (flat_graph , name = "flatten" )
@@ -112,7 +111,7 @@ def to_process_graph_argument(value: Union['PGNode', str, dict]) -> dict:
112111 """
113112 Normalize given argument properly to a "process_graph" argument
114113 to be used as reducer/subprocess for processes like
115- ' reduce_dimension', ' aggregate_spatial', ' apply', ' merge_cubes', ' resample_cube_temporal'
114+ `` reduce_dimension``, `` aggregate_spatial``, `` apply``, `` merge_cubes``, `` resample_cube_temporal``
116115 """
117116 if isinstance (value , str ):
118117 # assume string with predefined reduce/apply process ("mean", "sum", ...)
@@ -127,7 +126,7 @@ def to_process_graph_argument(value: Union['PGNode', str, dict]) -> dict:
127126
128127 @staticmethod
129128 def from_flat_graph (flat_graph : dict , parameters : Optional [dict ] = None ) -> 'PGNode' :
130- """Unflatten a given flat dict representation of a process graph and return result node"""
129+ """Unflatten a given flat dict representation of a process graph and return result node. """
131130 return PGNodeGraphUnflattener .unflatten (flat_graph = flat_graph , parameters = parameters )
132131
133132
0 commit comments