NEDAS.models.lorenz96.lorenz96_model module

class NEDAS.models.lorenz96.lorenz96_model.Lorenz96Model(**kwargs)[source]

Bases: Model[Grid1D]

Lorenz 1996 model with 40 variables

Parameters:
  • nx (int) – dimension of the model, default is 40.

  • F (float) – forcing parameter, default is 8

  • dt (float) – model time step, default is 0.05

  • numeric_opt (str) – numeric option, default is ‘rk4’

io_mode: Literal['online', 'offline'] = 'online'
nx: int
F: float
dt: float
restart_dt: float
numeric_opt: str
memory: dict = {}
dxdt(x)[source]
run_1step_euler_forward(x)[source]
run_1step_rk4(x)[source]
advance_time(x_in, T)[source]

Nonlinear advance_time function

Parameters:
  • x (np.ndarray) – the initial condition

  • T (float) – duration of the simulation

Returns:

the updated model state after simulation

Return type:

np.ndarray

filename(**kwargs)[source]
read_grid(**kwargs)[source]

Read the grid information from the model output.

Parameters:

**kwargs – Keyword arguments for reading the grid.

read_mask(**kwargs)[source]
read_var_from_file(**kwargs)[source]
write_var_to_file(var, **kwargs)[source]
z_coords(**kwargs)[source]

Get the vertical coordinates of the model.

Parameters:

**kwargs – Keyword arguments for getting the vertical coordinates.

Returns:

The vertical coordinates.

Return type:

np.ndarray

generate_initial_condition()[source]
preprocess(*args, **kwargs)[source]

Preprocess the model data.

Parameters:

**kwargs – Keyword arguments for preprocessing.

postprocess(*args, **kwargs)[source]

Postprocess the model data.

Parameters:

**kwargs – Keyword arguments for postprocessing.

run(*args, **kwargs)[source]

Run the model forward in time.

Parameters:
  • *args – Arguments

  • **kwargs – Keyword arguments

Keyword Arguments:
  • time (datetime) – current time when forecast starts

  • restart_dir (str) – directory where restart files are located

  • forecast_period (int) – forecast period in hours

If self.ens_run_strategy == ‘batch’, the method will run all ensemble members in one go, expect additional kwargs[‘nens’] to be the ensemble size. If self.ens_run_strategy == ‘scheduler’, the method runs a single member indexed by kwargs[‘member’], and kwargs[‘worker_id’] is the pid assigned by the scheduler to run this method.

generate_truth(*args, **kwargs)[source]

Generate truth (nature run) model states. Use for running synthetic observation experiments.

generate_init_ensemble(*args, **kwargs)[source]

Generate initial perturbed model states for ensemble forecasts.

Parameters:
  • nens (int) – ensemble size

  • **kwargs