NEDAS.models.topaz.v4 package

class NEDAS.models.topaz.v4.Topaz4Model(**kwargs)[source]

Bases: Model[RegularGrid]

io_mode: Literal['online', 'offline'] = 'offline'
basedir: str
R: str
T: str
E: str
V: str
X: str
onem: float
z_units: str
restart_dt: int
forcing_frc: str
era5_path: str
priver: int
jerlv0: int
relax: int
nproc: int
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()[source]
read_var(**kwargs)[source]

Read a variable from the model output.

Parameters:

**kwargs – Keyword arguments for reading the variable.

Returns:

The read variable.

Return type:

np.ndarray

write_var(var, **kwargs)[source]

Write a variable to the model output.

Parameters:
  • var (np.ndarray) – The variable to write.

  • **kwargs – Keyword arguments for writing the variable.

z_coords(**kwargs) → ndarray[source]

Calculate vertical coordinates given the 3D model state. :returns: The corresponding z field. :rtype: np.ndarray

Public entry point – accepts the flexible **kwargs calling convention used throughout the codebase (FieldRecord.asdict(), ObsRecord.asdict(), obs_seq entries merged in by core/obs.py, etc.), but the cached implementation only ever needs member/time/k/path to locate and read a field (name/units get overridden internally, see _z_coords_cached; everything else has a default – see base Model’s parse_kwargs). Extracting exactly those four here, into _z_coords_cached’s own explicit (non-**kwargs) signature, means nothing else the caller’s kwargs happens to contain – an obs_seq entry’s x/y/z coordinate arrays today, whatever gets added tomorrow – ever reaches the lru_cache boundary at all: it’s excluded by not being a parameter, not by being matched against a list of known-bad fields. Same fix as topaz/v5. ‘path’ specifically must be one of the four kept: see io_backends/offline.py’s call_method, which resolves the correct forecast-cycle path (using model_src from the original kwargs) and injects it before calling z_coords – drop it and parse_kwargs falls back to config.work_dir alone (missing the /cycle/<time>/<model> suffix), silently pointing at the wrong directory instead of raising.

preprocess(task_id=0, **kwargs)[source]

Preprocess the model data.

Parameters:

**kwargs – Keyword arguments for preprocessing.

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.

Submodules