AFL.double_agent.PipelineOp module#
- class AFL.double_agent.PipelineOp.PipelineOp(name: str | None | List[str] = None, input_variable: str | None | List[str] = None, output_variable: str | None | List[str] = None, input_prefix: str | None | List[str] = None, output_prefix: str | None | List[str] = None)#
Bases:
ABCAbstract base class for data processors. All operations in AFL.double_agent should inherit PipelineOpBase.
- Parameters:
name (Optional[str] | List[str]) – The name to use when added to a Pipeline. This name is used when calling Pipeline.search()
input_variable (Optional[str] | List[str]) – The name of the xarray.Dataset data variable to extract from the input dataset
output_variable (Optional[str] | List[str]) – The name of the variable to be inserted into the xarray.Dataset by this PipelineOp
input_prefix (Optional[str] | List[str]) – Prefix for input variables when using pattern matching
output_prefix (Optional[str] | List[str]) – Prefix for output variables when using pattern matching
- PROVIDED_KEYS: tuple = ()#
- add_to_dataset(dataset, copy_dataset=True)#
Adds (xarray) data in output dictionary to provided xarray dataset
- add_to_tiled(tiled_data)#
Adds data in output dictionary to provided tiled catalogue
- abstract calculate(dataset: Dataset) Self#
- copy() Self#
- classmethod from_json(json_data, objects: Dict[str, object] | None = None)#
Rebuild an op from
to_json()output.- Parameters:
json_data (dict) –
{"class": ..., "args": {...}}.objects (dict, optional) – Live objects for
{"ref": ...}arguments, keyed by reference ("<op name>.<arg>"), e.g.pipeline.objectsof the pipeline that was exported orAFL.double_agent.Pipeline.load_environment()of a module that defines it.
- Raises:
UnresolvedReferenceError – If an argument is a reference and
objectsdoes not contain it.
- live_objects() Dict[str, object]#
Constructor arguments kept in memory (no JSON form), keyed by their export reference.
- plot(sample_dim: str = 'sample', **mpl_kwargs) Figure#
Plots the output of the PipelineOp.
This method attempts to guess how to plot the data produced by the operation.
- to_json()#
Serialize the class path and constructor arguments to a JSON-safe dict.
Arguments without a JSON form are written as
{"ref": "<name>.<arg>"}; the live objects are available fromlive_objects()and must be passed back tofrom_json()(objects=) when the pipeline is reloaded.