forcings

class anemoi.inference.forcings.Forcings(context: TensorHandler)

Bases: ABC

Represents a forcings provider for the model.

abstractmethod load_forcings_array(dates: list[str | datetime | int], current_state: dict[str, Any]) ndarray[tuple[Any, ...], dtype[Any]]

Load the forcings for the given dates.

Parameters:
  • dates (List[Date]) – The list of dates for which to load the forcings.

  • current_state (State) – The current state of the model.

Returns:

The loaded forcings as a numpy array.

Return type:

FloatArray

class anemoi.inference.forcings.ComputedForcings(context: TensorHandler, variables: list[str], mask: Any)

Bases: Forcings

Compute forcings like cos_julian_day or insolation.

load_forcings_array(dates: list[str | datetime | int], current_state: dict[str, Any]) ndarray[tuple[Any, ...], dtype[Any]]

Load the computed forcings for the given dates.

Parameters:
  • dates (List[Date]) – The list of dates for which to load the forcings.

  • current_state (State) – The current state of the model.

Returns:

The loaded forcings as a numpy array.

Return type:

FloatArray

class anemoi.inference.forcings.CoupledForcings(context: TensorHandler, input: Input, variables: list[str], mask: ndarray[tuple[Any, ...], dtype[Any]])

Bases: Forcings

Retrieve forcings from the input.

property trace_name: str

Return the trace name of the input.

load_forcings_array(dates: list[str | datetime | int], current_state: dict[str, Any]) ndarray[tuple[Any, ...], dtype[Any]]

Load the forcings for the given dates.

Parameters:
  • dates (List[Any]) – The list of dates for which to load the forcings.

  • current_state (State) – The current state of the model.

Returns:

The loaded forcings as a numpy array.

Return type:

FloatArray

class anemoi.inference.forcings.ConstantForcings(context: TensorHandler, input: Input, variables: list[str], mask: ndarray[tuple[Any, ...], dtype[Any]])

Bases: CoupledForcings

class anemoi.inference.forcings.BoundaryForcings(context: TensorHandler, input: DatasetInput, variables: list[str], variables_mask: ndarray[tuple[Any, ...], dtype[Any]])

Bases: Forcings

Retrieve boundary forcings from the input.

load_forcings_array(dates: list[str | datetime | int], current_state: dict[str, Any]) ndarray[tuple[Any, ...], dtype[Any]]

Load the boundary forcings for the given dates.

Parameters:
  • dates (List[Date]) – The list of dates for which to load the forcings.

  • current_state (State) – The current state of the model.

Returns:

The loaded forcings as a numpy array.

Return type:

FloatArray