rtm_wrapper.engines.base#

RTM engine definition.

Module Contents#

Classes#

RTMEngine

Base class for wrappers interfaces around specific RTMs.

ParameterRegistry

Registry of input parameters supported by an RTM engine.

OutputRegistry

Registry of outputs that can be extracted from an RTM engine run.

class RTMEngine(*, outputs: collections.abc.Iterable[OutputName] | None = None)[source]#

Bases: abc.ABC

Base class for wrappers interfaces around specific RTMs.

Parameters:

outputs (collections.abc.Iterable[OutputName] | None) –

property requested_outputs: tuple[OutputName, Ellipsis]#

Currently configured outputs for this engine.

Re-assign to change the configured outputs.

Return type:

tuple[OutputName, Ellipsis]

params: ClassVar[ParameterRegistry[Ellipsis]]#

Registry of the input parameters that this engine can handle.

outputs: ClassVar[OutputRegistry]#

Registry of the outputs that can be extracted from run of this engine.

virtual_outputs: ClassVar[tuple[OutputName, Ellipsis]] = ()#

Mock outputs produced by this engine without invoking an output extractor.

default_outputs: ClassVar[tuple[OutputName, Ellipsis]]#

The default outputs returned from runs of this engine.

This can be overridem by passing the outputs keyword argument to __init__.

abstract run_simulation(inputs: rtm_wrapper.simulation.Inputs) EngineOutputs[source]#

Run this RTM module using the given inputs.

Parameters:

inputs (rtm_wrapper.simulation.Inputs) – Input parameter tree.

Return type:

EngineOutputs

class ParameterRegistry[source]#

Bases: Generic[P]

Registry of input parameters supported by an RTM engine.

register(name: rtm_wrapper.simulation.InputTopName, type_: type[rtm_wrapper.parameters.Parameter] | None = None) Callable[[ParameterHandler[R, P]], ParameterHandler[R, P]][source]#

Return decorator for registering a new input parameter.

Parameters:
  • name (rtm_wrapper.simulation.InputTopName) –

  • type_ (type[rtm_wrapper.parameters.Parameter] | None) –

Return type:

Callable[[ParameterHandler[R, P]], ParameterHandler[R, P]]

class OutputRegistry[source]#

Registry of outputs that can be extracted from an RTM engine run.

property names: collections.abc.Iterable[OutputName]#

Return an iterable of the names of all outputs that have been registered.

Return type:

collections.abc.Iterable[OutputName]

register(func: OutputExtractor | None = None, /, name: str | None = None, depends: tuple[OutputName, Ellipsis] | None = None, title: str | None = None, unit: str | None = None, dtype: numpy.dtype[Any] | None = None) Callable[[OutputExtractor], OutputExtractor][source]#

Return a decorator for registering an RTM engine output.

Parameters:
  • func (OutputExtractor | None) –

  • name (str | None) –

  • depends (tuple[OutputName, Ellipsis] | None) –

  • title (str | None) –

  • unit (str | None) –

  • dtype (numpy.dtype[Any] | None) –

Return type:

Callable[[OutputExtractor], OutputExtractor]

extraction_order(requested: collections.abc.Iterable[OutputName]) tuple[OutputName, Ellipsis][source]#

Return a minial static extraction order for extracting the requested outputs.

Parameters:

requested (collections.abc.Iterable[OutputName]) – Names of outputs that must be extracted.

Returns:

Valid extraction order for obtaining the requested outputs. Includes the requested outputs and their minimal prerequisites.

Return type:

tuple[OutputName, Ellipsis]