NEDAS.models.nextsim.v2.nextsim_model module
- class NEDAS.models.nextsim.v2.nextsim_model.NextsimModel(**kwargs)[source]
Bases:
ModelClass for configuring and running the neXtSIM v2 model (lagrangian version)
- nextsim_dir: str
- model_env: str
- nextsim_mesh_dir: str
- msh_filename: str
- nextsim_data_dir: str
- ocean_forcing_path: str
- restart_input_path: str
- restart_dt: float
- atmos_forcing_path: str
- forcing_dt: float
- write_grid(**kwargs)[source]
write updated mesh back to mesh file
Note: now we assume that number of mesh elements and their indices doesn’t change! only updating the mesh node position x,y
- displace(u, v, **kwargs)[source]
Nextsim has a Lagrangian mesh, so it’s possible to displace the mesh coordinates directly Inputs: - u, v: displacement vectors defined on self.grid.x,y
- 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
- read_param(**kwargs)[source]
Read a scalar parameter from the model.
Default implementation reads from self.memory[‘param’][mstr][name], falling back to the on-disk param store in offline mode (see write_param), then to getattr(self, name) if nowhere else.
- Parameters:
name (str) – parameter name
member (int|None) – ensemble member index
- Returns:
the parameter value
- Return type:
float
- write_param(value, **kwargs)[source]
Write a scalar parameter to the model.
Default implementation stores in self.memory[‘param’][mstr][name] and, in offline mode, also persists to an on-disk per-member store so the value survives across the per-step/per-member subprocesses (see _param_file).
- Parameters:
value (float) – the parameter value to write
name (str) – parameter name
member (int|None) – ensemble member index
- postprocess(task_id=0, **kwargs)[source]
Postprocess the model data.
- Parameters:
**kwargs – Keyword arguments for postprocessing.
- run(task_id=0, **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.