NEDAS.models.bgrid_solo.bgrid_solo_model module

class NEDAS.models.bgrid_solo.bgrid_solo_model.BgridSoloModel(**kwargs)[source]

Bases: Model[RegularGrid]

Dry dynamical core of the GFDL B-grid atmospheric model, with Held-Suarez forcing.

This is the bgrid_solo model of DART: the FMS B-grid core, with the physics reduced to the Held and Suarez (1994) benchmark (Newtonian relaxation to a zonally symmetric equilibrium temperature and Rayleigh friction near the surface), on a global latitude- longitude grid. The default 60x30 grid with 5 levels is close to the smallest that has realistic baroclinic instability, with midlatitude storm tracks.

Both io modes are supported, with the DART model source built by build_bgrid_solo.sh:

  • offline: the state of each member is a DART netCDF restart file, advanced by the nedas_bgrid_advance executable, which reads it, advances it by the requested time and writes it back.

  • online: the state of each member is DART’s state vector held in self.memory, advanced in place by the same model code called from libnedas_bgrid.so (nedas_bgrid_lib.f90), with no file io. Both modes give identical states.

The prognostic variables are surface pressure ps (Pa), temperature t (K) and horizontal wind u, v (m/s) on 5 sigma levels (level 0 is the top). NEDAS carries them all on the temperature grid, the wind is on a staggered grid in the model (at the north-east corners of the temperature cells). Reading the wind averages the four surrounding wind points, writing it adds the changes from the (analysis of the) averaged field back to the wind points, so that a field left unchanged is written back exactly.

Parameters:
  • nlon (int) – number of longitudes, latitudes and levels

  • nlat (int) – number of longitudes, latitudes and levels

  • nlev (int) – number of longitudes, latitudes and levels

  • dt_atmos (int) – model time step in seconds

  • model_exe (str) – path to the nedas_bgrid_advance executable (offline io mode)

  • model_lib (str) – path to libnedas_bgrid.so (online io mode)

  • spinup_hours (int) – spin up period for the initial conditions

nlon: int
nlat: int
nlev: int
dt_atmos: int
time_ref: str
spinup_hours: float
init_perturb_sd: float
init_ens_mode: str
seed: int
restart_dt: float
memory: dict = {}
model_exe: str
model_lib: str
filename(**kwargs) → str[source]
model_day(time: datetime) → float[source]

DART model time (days) of a date

read_grid(**kwargs)[source]

Read the grid information from the model output.

Parameters:

**kwargs – Keyword arguments for reading the grid.

read_mask(**kwargs)[source]
z_coords(**kwargs) → ndarray[source]

Nominal pressure (hPa) at the bottom of the layer of level k: NEDAS takes z of a level as the bottom of its layer, with the variable at the layer center (Obs.vertical_interp). The sigma levels are equally spaced from the top, so level k is at (k + 0.5) / nlev * 1000 hPa, in the layer from k / nlev to (k + 1) / nlev * 1000 hPa. ps is the surface, 1000 hPa.

read_var_from_file(**kwargs) → ndarray[source]
write_var_to_file(var, **kwargs) → None[source]
property state_size: int
get_state(**kwargs) → ndarray[source]

the state vector in memory at kwargs time, tag and member

set_state(x: ndarray, **kwargs) → None[source]

store a state vector in memory at kwargs time, tag and member

read_var_from_memory(**kwargs) → ndarray[source]
write_var_to_memory(var, **kwargs) → None[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.

lib() → CDLL[source]

libnedas_bgrid, loaded and set up with this model’s settings

advance_state(x: ndarray, time: datetime, hours: float) → ndarray[source]

advance a state vector from time by the given hours, in memory; returns the new state

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.

cold_start_state(seed: int) → ndarray[source]

the cold start as a state vector (in memory), with the temperature perturbation

cold_start(fname: str, time: datetime, seed: int, **kwargs) → None[source]

Write the initial state at time to fname: the model’s cold start (at rest, uniform temperature) plus a random temperature perturbation to trigger baroclinic instability.

perturb_state(fname: str, seed: int, sd: float) → None[source]

add random noise of standard deviation sd (K) to the temperature in a state file

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

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

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

Generate initial perturbed model states for ensemble forecasts.

Parameters:
  • nens (int) – ensemble size

  • **kwargs