NEDAS.io_backends.online module

class NEDAS.io_backends.online.OnlineIO[source]

Bases: IOBackend

Online IO backend. Keep data in the memory and avoid file IO completely.

Only works for single processor now, but this is convenient for long experiments and simple models

io_mode: Literal['online', 'offline'] = 'online'
shared_data: dict[str, Any] = {}
read_field(c: Context, tag: str, rec_id: int, mem_id: int) ndarray[source]

Read a field from memory

write_field(fld: ndarray, c: Context, tag: str, rec_id: int, mem_id: int) None[source]

Write a field to memory

call_method(c: Context, tag: str, method: Callable, *args, **kwargs)[source]

Call a method to perform some tasks.

Parameters:
  • c (Context) – the runtime context

  • tag (str) – which copy of the model state to request io from: “prior”, “post” or “truth”

  • method (Callable) – method name

  • *args – will be passed to the method

  • **kwargs – will be passed to the method

Returns:

whatever the method(**kwargs) returns

Return type:

Any