NEDAS.io_backends.offline module

class NEDAS.io_backends.offline.OfflineIO[source]

Bases: IOBackend

Offline IO backend using restart files to hold model state (a pause-restart strategy)

io_mode: Literal['online', 'offline'] = 'offline'
binfile_name(c: Context, tag: str) str[source]

Name of the binary file that stores the state data.

Parameters:
  • c (Context) – the runtime context

  • tag (str) – which version of the state

Returns:

file name

Return type:

str

prepare_fields_storage(c: Context, tag: str)[source]

Prepare for storage of fields data. Only needed for offline io modes: initialize the binary file that stores fields and write its metadata.

read_field(c: Context, tag: str, rec_id: int, mem_id: int) ndarray[source]

Read a field from cache or binary file

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

Write a field to a binary file

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