NEDAS.models.vort2d package
Submodules
NEDAS.models.vort2d.generate_init_ensemble module
NEDAS.models.vort2d.generate_truth module
NEDAS.models.vort2d.model module
NEDAS.models.vort2d.util module
- NEDAS.models.vort2d.util.initial_condition(grid, Vmax, Rmw, Vbg, Vslope, loc_sprd=0)[source]
Initialize the 2d vortex model with a Rankine vortex embedded in a random wind flow.
- Parameters:
grid (Grid) – The model domain, doubly periodic, described by a Grid obj
Vmax (float) – Maximum wind speed (vortex intensity), m/s
Rmw (float) – Radius of maximum wind (vortex size), m
Vbg (float) – Background flow average wind speed, m/s
Vslope (int) – Background flow kinetic energy spectrum power law (typically -2)
loc_sprd (float, optional) – The ensemble spread in vortex center position, m
- Returns:
The vector velocity field, shape (2, ny, nx).
- Return type:
np.ndarray
- NEDAS.models.vort2d.util.rankine_vortex(grid, Vmax, Rmw, center_x, center_y)[source]
Generate a Rankine vortex velocity field.
- Parameters:
grid (Grid) – The model domain, doubly periodic
Vmax (float) – Maximum wind speed (vortex intensity), m/s
Rmw (float) – Radius of maximum wind (vortex size), m
center_x (float) – Vortex center X-coordinate.
center_y (float) – Vortex center Y-coordinate.
- Returns:
The vector velocity field with shape (2, ny, nx)
- Return type:
np.ndarray
- NEDAS.models.vort2d.util.random_flow(grid, amp, power_law)[source]
Generate a random velocity field as the background flow
- Parameters:
grid (Grid) – The model domain, doubly periodic, described by a Grid obj
amp (float) – wind speed amplitude, m/s
power_law (int) – wind kinetic energy spectrum power law (typically -2)
- Returns:
The vector velocity field with shape (2, ny, nx)
- Return type:
np.ndarray
- NEDAS.models.vort2d.util.advance_time(fld: ndarray, dx: float, t_intv: float, dt: float, gen: float, diss: float) ndarray[source]
Advance forward in time to integrate the model (forecasting)
- Parameters:
fld (np.ndarray) – The prognostic velocity field with shape (2,ny,nx)
dx (float) – Model grid spacing, meter
t_intv (float) – Integration time period, hour
dt (float) – Model time step, second
gen (float) – Vorticity generation rate
diss (float) – Dissipation rate
- Returns:
The forecast velocity field
- Return type:
np.ndarray
Module contents
- class NEDAS.models.vort2d.Vort2DModel(**kwargs)[source]
Bases:
Model[RegularGrid]- nx: int
- ny: int
- dx: float
- dt: float
- restart_dt: float
- Vmax: float
- Rmw: float
- Vbg: float
- Vslope: float
- loc_sprd: int
- gen: float
- diss: float
- memory: dict = {}
- read_grid(**kwargs)[source]
Read the grid information from the model output.
- Parameters:
**kwargs – Keyword arguments for reading the grid.
- 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
- preprocess(**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.