NEDAS.core.state_info module

class NEDAS.core.state_info.StateInfo(c: Context)[source]

Bases: object

Manages the metadata, indexing, and memory offsets for the model state.

Variables:
  • shape (tuple) – domain dimension(s) for the fields

  • fields (dict[int, FieldRecord]) – dictionary containing field ids and the corresponding field records

  • size (int) – total size of the complete state (bytes), for one member

  • variables (set[str]) – set of unique variables in the state

  • err_types (set[str]) – set of unique error models in the state

shape: tuple
mask: ndarray
fields: dict[int, FieldRecord]
size: int
variables: list[str]
err_types: list[str]
add_fields_for_variable(c: Context, vrec: dict) None[source]

Add fields for a variable in the state. The state variable has dimensions t, z, y, x while the ‘field’ is the 2D part with y, x dimensions.

Parameters:
  • c (Context) – the runtime context object

  • vrec (dict) – the variable record defining its properties

write_to_file(binfile: str)[source]

Write the info to a .dat file accompanying the .bin file

Parameters:

binfile (str) – File path for the .bin file

read_from_file(binfile: str)[source]

Read .dat file accompanying the .bin file and updates state_info

Parameters:

binfile (str) – File path for the .bin file