pyfvcom2.sigma module
- class pyfvcom2.sigma.SigmaConfig(nlev: int, sigtype: str, sigpow: float | None = None, du: float | None = None, dl: float | None = None, min_constant_depth: float | None = None, ku: int | None = None, kl: int | None = None, zku: ndarray | None = None, zkl: ndarray | None = None)
Bases:
NamedTupleNamed tuple containing sigma coordinate configuration parameters.
- Variables:
nlev (int) – Number of sigma levels.
sigtype (str) – Sigma coordinate type (e.g., ‘uniform’, ‘geometric’, ‘tanh’, ‘generalized’).
sigpow (float | None) – Power value for geometric sigma coordinates.
du (float | None) – Upper depth boundary thickness.
dl (float | None) – Lower depth boundary thickness.
min_constant_depth (float | None) – Minimum water depth for generalized coordinates.
ku (int | None) – Number of levels in upper boundary.
kl (int | None) – Number of levels in lower boundary.
zku (numpy.ndarray | None) – Depths of upper boundary layers.
zkl (numpy.ndarray | None) – Depths of lower boundary layers.
- dl: float | None
Alias for field number 4
- du: float | None
Alias for field number 3
- kl: int | None
Alias for field number 7
- ku: int | None
Alias for field number 6
- min_constant_depth: float | None
Alias for field number 5
- nlev: int
Alias for field number 0
- sigpow: float | None
Alias for field number 2
- sigtype: str
Alias for field number 1
- zkl: ndarray | None
Alias for field number 9
- zku: ndarray | None
Alias for field number 8
- class pyfvcom2.sigma.SigmaData(sigma_config: SigmaConfig, sigma_levels: ndarray)
Bases:
NamedTupleNamed tuple containing sigma coordinate data.
- Attrs:
sigma_config: Sigma configuration parameters. sigma_levels: 2D array of sigma levels at each node.
- sigma_config: SigmaConfig
Alias for field number 0
- sigma_levels: ndarray
Alias for field number 1
- pyfvcom2.sigma.hybrid_sigma_coordinate(levels: int, transition_depth: float, upper_layer_depth: float, lower_layer_depth: float, total_upper_layers: int, total_lower_layers: int, h: ndarray) SigmaData
Create a hybrid vertical coordinate system.
- Parameters:
levels – Number of vertical levels.
transition_depth – Transition depth of the hybrid coordinates.
upper_layer_depth – Upper water boundary thickness (metres).
lower_layer_depth – Lower water boundary thickness (metres).
total_upper_layers – Number of layers in the DU water column.
total_lower_layers – Number of layers in the DL water column.
h – Water depth at nodes.
- Returns:
- A named tuple containing:
sigma_config (SigmaConfig): Configuration for the sigma coordinate system.
sigma_levels (np.ndarray): Sigma levels at each node.
- Return type:
- pyfvcom2.sigma.process_sigma_config(config: SigmaConfig, h: ndarray) SigmaData
Read in a sigma coordinates file and generate sigma coordinate parameters.
- Parameters:
config – Sigma configuration parameters.
h – Bathymetry at nodes.
- Returns:
- A named tuple containing:
sigma_config (SigmaConfig): Sigma configuration as read from file.
sigma_levels (np.ndarray): Sigma levels at each node.
- Return type:
- pyfvcom2.sigma.read_sigma_file(filepath: str) SigmaConfig
Read in a sigma coordinates file and return parsed configuration.
- Parameters:
filepath – Path to FVCOM sigma coordinates .dat file.
- Returns:
Named tuple containing all sigma coordinate parameters.
Notes
This is more or less a direct python translation of the original MATLAB fvcom-toolbox function read_sigma.m
- pyfvcom2.sigma.sigma_generalized(levels: int, dl: float, du: float, h: float, hmin: float, kl: int, ku: int, zku: list = [], zkl: list = []) ndarray
Generate a generalised sigma coordinate distribution.
- Parameters:
levels – Number of sigma levels.
dl – The lower depth boundary from the bottom, down to which the layers are uniform thickness.
du – The upper depth boundary from the surface, up to which the layers are uniform thickness.
h – Water depth (positive down).
hmin – Minimum water depth (positive down).
kl – Number of levels in lower boundary.
ku – Number of levels in upper boundary.
zku – Depths of upper boundary layers. Calculated evenly if not given.
zkl – Depths of lower boundary layers. Calculated evenly if not given.
- Returns:
Generalised vertical sigma coordinate distribution.
- pyfvcom2.sigma.sigma_geometric(levels: int, p_sigma: int) ndarray
Generate a geometric sigma coordinate distribution.
- Parameters:
levels – Number of sigma levels.
p_sigma – Power value. 1 for uniform sigma layers, 2 for parabolic function. See page 308-309 in the FVCOM manual for examples.
- Returns:
Geometric vertical sigma coordinate distribution.
- pyfvcom2.sigma.sigma_tanh(levels: int, dl: float, du: float) ndarray
Generate a hyperbolic tangent vertical sigma coordinate distribution.
- Parameters:
levels – Number of sigma levels (layers + 1).
dl – The lower depth boundary from the bottom down to which the coordinates are parallel with uniform thickness.
du – The upper depth boundary from the surface up to which the coordinates are parallel with uniform thickness.
- Returns:
Hyperbolic tangent vertical sigma coordinate distribution.
- pyfvcom2.sigma.write_sigma_file(sigma_config: SigmaConfig, sigma_file: str)
Write the sigma distribution to file.
- Parameters:
sigma_config – Sigma configuration to write.
sigma_file – Path to which to save sigma data.