API reference

This page provides an auto-generated summary of pyDOMCFG’s API.

Accessor

Attributes

Dataset.domcfg.jpk

Number of computational levels

Methods

Dataset.domcfg.from_namelist(nml_cfg_path_or_io)

Auto-populate pydomcfg parameters using NEMO DOMAINcfg namelists.

Dataset.domcfg.zco(*args, **kwargs)

Generate NEMO geopotential z-coordinates model levels.

Domzgr

Zco

class pydomcfg.domzgr.zco.Zco(ds_bathy, jpk)[source]

Class to generate geopotential z-coordinates dataset objects.

__init__(ds_bathy, jpk)

Initialize class.

Parameters
ds_bathy: Dataset

xarray dataset including grid coordinates and bathymetry. All bathymetry values MUST be >= 0, where 0 is land.

jpk: int

number of computational levels

__call__(ppdzmin, pphmax, ppkth=0, ppacr=0, ppsur=None, ppa0=None, ppa1=None, ppa2=None, ppkth2=None, ppacr2=None, ln_e3_dep=True)[source]

Generate NEMO geopotential z-coordinates model levels.

Parameters
ppdzmin: float

Minimum thickness for the top layer (units: m)

pphmax: float

Depth of the last W-level (total depth of the ocean basin) (units: m)

ppkth: float, default = 0

Model level at which approximately max stretching occurs. Nondimensional > 0, usually of order 1/2 or 2/3 of jpk. (0 means no stretching, uniform grid)

ppacr: int, default = 0

Stretching factor, nondimensional > 0. The larger ppacr, the smaller the stretching. Values from 3 to 10 are usual. (0 means no stretching, uniform grid)

ppsur, ppa0, ppa1: float, optional

Coefficients controlling distibution of vertical levels (None: compute from ppdzmin, pphmax, ppkth and ppacr)

ppa2, ppkth2, ppacr2: float, optional

Double tanh stretching function parameters. (None: Double tanh OFF)

ln_e3_dep: bool, default = True

Logical flag to comp. e3 as fin. diff. (True) oranalyt. (False) (default = True)

Returns
Dataset

Describing the 3D geometry of the model

See also

pydomcfg.domzgr.zco.Zco.__call__

Underlying method.

NEMOv4.0

domzgr/zgr_z subroutine

Notes

  • Model levels’ depths z3{T,W} are defined from analytical function.

  • Model vertical scale factors e3{T,W} (i.e., grid cell thickness) can be computed as:

    • analytical derivative of depth function (ln_e3_dep=False); for backward compatibility with v3.6.

    • discrete derivative (central-difference) of levels’ depth (ln_e3_dep=True). The only possibility from v4.0.

  • See [1] and equations E.1-4 in the NEMO4 v4 ocean engine manual [2].

References

1

Marti, O., Madec, G., and Delecluse, P. (1992), Comment [on “Net diffusivity in ocean general circulation models with nonuniform grids” by F. L. Yin and I. Y. Fung], J. Geophys. Res., 97( C8), 12763– 12766, http://doi.org/10.1029/92JC00306.

2

Madec Gurvan, Romain Bourdallé-Badie, Jérôme Chanut, Emanuela Clementi, Andrew Coward, Christian Ethé, … Guillaume Samson. (2019, October 24). NEMO ocean engine (Version v4.0). Notes Du Pôle De Modélisation De L’institut Pierre-simon Laplace (IPSL). Zenodo. http://doi.org/10.5281/zenodo.3878122

Utils

utils.generate_cartesian_grid(ppe1_m, ppe2_m)

Generate coordinates and spacing of a NEMO Cartesian grid.