tasks

runner

class anemoi.inference.tasks.runner.CouplingForcings(context, input, variables, mask)

Bases: CoupledForcings

Just to have a different __repr__.

class anemoi.inference.tasks.runner.CoupledRunner(config: dict[str, Any], coupled_input: CoupledInput)

Bases: Runner

Runner for coupled models.

This class handles the initialization and running of coupled models using the provided configuration and input.

input_state_hook(input_state: dict[str, Any]) None

Hook used by coupled runners to send the input state.

output_state_hook(state: dict[str, Any]) None

Hook used by coupled runners to send the input state.

create_dynamic_coupled_forcings(variables: list[str], mask: Any) list[CoupledForcings]

Create dynamic coupled forcings.

Parameters:
  • variables (list of str) – List of variable names.

  • mask (Any) – Mask to apply to the variables.

Returns:

List of coupled forcings.

Return type:

list of CoupledForcings

initial_dynamic_forcings_providers(dynamic_forcings_providers: list[Forcings]) list[Forcings]

Modify the dynamic forcings providers for the first step.

Parameters:

dynamic_forcings_providers (list of Forcings) – The dynamic forcings providers.

Returns:

The modified dynamic forcings providers.

Return type:

list[Forcings]

class anemoi.inference.tasks.runner.CoupledInput(task: Task, transport: Any, couplings: list[Coupling])

Bases: object

Input handler for coupled models.

This class manages the input data and state for coupled models, including loading and initializing forcings.

trace_name = 'coupled'
load_forcings_state(*, dates: list[str | datetime | int], current_state: dict[str, Any]) dict[str, Any]

Load the forcings state.

Parameters:
  • dates (list of Date) – List of dates.

  • current_state (State) – Current state dictionary.

Returns:

Updated state dictionary.

Return type:

State

initial_state(state: dict[str, Any]) None

Initialize the state.

Parameters:

state (State) – State dictionary.

output_state(state: dict[str, Any]) None

Output the state.

Parameters:

state (State) – State dictionary.

class anemoi.inference.tasks.runner.TestCoupledRunner(config: dict[str, Any], coupled_input: CoupledInput)

Bases: CoupledRunner

Runner for testing coupled models.

class anemoi.inference.tasks.runner.NoModelCoupledRunner(config: dict[str, Any], coupled_input: CoupledInput)

Bases: NoModelMixing, CoupledRunner

Runner for testing coupled models.

class anemoi.inference.tasks.runner.RunnerTask(name: str, config: dict[str, Any], overrides: dict[str, Any] = {}, global_config: dict[str, Any] = {})

Bases: Task

Task for running coupled models.

This task initializes and runs coupled models using the provided configuration, overrides, and global configuration.

run(transport: Transport) None

Run the task.

Parameters:

transport (Transport) – Transport instance.