NEDAS.models.topaz.v5.topaz5model module

class NEDAS.models.topaz.v5.topaz5model.Topaz5Model(**kwargs)[source]

Bases: Model[RegularGrid]

TOPAZ5 model class.

io_mode: Literal['online', 'offline'] = 'offline'
nhc_root: str
basedir: str
model_env: str | None
reanalysis_code: str
V: str
X: str
T: str
R: str
E: str
idm: int
jdm: int
kdm: int
nproc: int
use_job_array: bool
max_num_attempts: int
meanssh_file: str
forcing_file: str
restart_dt: int
output_dt: int
forcing_dt: int
z_units: str
thflag: int
thref: float
thbase: float
kapref: int
yrflag: int
ONEM: float
MIN_SEAICE_CONC: float
MAX_OCEAN_TEMP: float
MIN_OCEAN_SALN: float
MAX_OCEAN_SALN: float
ncat: int
Nilayer: int
saltmax: float
min_salin: float
depressT: float
nsal: float
msal: float
aice_thresh: float
fice_thresh: float
seaice_thick_obs_impact: float
preproc_copy_forcing: bool = True
preproc_copy_restart: bool = True
postprocess_method: str = 'fixhycom'
is_ncat(name)[source]
get_cat_id(name)[source]
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(**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)[source]

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. ‘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.

get_ocean_surf_height(**kwargs)[source]

Get ocean surface height from restart variables Adapted from p_ssh_from_state.F90 in ReanalysisTP5/SSHFromState_HYCOMICE

get_seaice_conc(**kwargs)[source]

Get total seaice concentration from multicategory ice concentration (aicen) adapted from ReanalysisTP5/SSHFromState_HYCOMICE/mod_read_icednc by J. Xie

get_seaice_thick(**kwargs)[source]

Get total seaice thickness from the multicategory ice volume (vicen)

get_snow_thick(**kwargs)[source]

Get total snow thickness from the multi-category snow volume (vsnon)

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.

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

Post processing the restart variables for next forecast

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