opendrift.readers.roppy.depth
Vertical structure functions for ROMS
sdepth()Depth of s-levels
zslice()Slice a 3D field in s-coordinates to fixed depth
multi_zslice()Slice a 3D field to several depth levels
z_average()Vertical average of a 3D field
s_stretch()Compute vertical stretching arrays Cs_r or Cs_w
Attributes
Functions
|
Depth of s-levels |
|
Return depth of w-points in s-levels |
|
Vertical slice of a 3D ROMS field |
|
Slice a 3D ROMS field to fixed depth |
|
Slice a 3D ROMS field to fixed depth |
|
Compute a s-level stretching array |
|
Returns S for Vstretching = 5 |
|
Obsolete use s_stretch instead |
Module Contents
- opendrift.readers.roppy.depth.Array
- opendrift.readers.roppy.depth.sdepth(H, zeta, Hc, C, S=None, stagger='rho', Vtransform=1, Vstretching=1)[source]
Depth of s-levels
- Harraylike
Bottom depths [meter, positive]
- Hcscalar
Critical depth
- C1D array
s-level stretching curve
- S1D array
s coordinate at rho or w points
stagger : [ ‘rho’ | ‘w’ ]
- Vtransform[ 1 | 2 ]
defines the transform used, defaults 1 = Song-Haidvogel
Returns an array with ndim = H.ndim + 1 and shape = cs_r.shape + H.shape with the depths of the mid-points in the s-levels.
Typical usage:
>> fid = Dataset(roms_file) >> H = fid.variables['h'][:, :] >> C = fid.variables['Cs_r'][:] >> Hc = fid.variables['hc'].getValue() >> z_rho = sdepth(H, Hc, C)
- Parameters:
H (numpy.typing.NDArray[numpy.float64])
zeta (numpy.typing.NDArray[numpy.float64])
Hc (float)
C (numpy.typing.NDArray[numpy.float64])
S (Optional[numpy.typing.NDArray[numpy.float64]])
stagger (str)
Vtransform (int)
Vstretching (int)
- Return type:
numpy.typing.NDArray[numpy.float64]
- opendrift.readers.roppy.depth.sdepth_w(H, Hc, cs_w)[source]
Return depth of w-points in s-levels
Kept for backwards compatibility use sdepth(H, Hc, cs_w, stagger=’w’) instead
- opendrift.readers.roppy.depth.zslice(F, S, z)[source]
Vertical slice of a 3D ROMS field
Vertical interpolation of a field in s-coordinates to (possibly varying) depth level
F : array with vertical profiles, first dimension is vertical
- Sarray with depths of the F-values, S.shape = F.shape
typically, S = z_rho or S = z_w
- zDepth level(s) for output, scalar or
shape = F.shape[1:] The z values should be negative
Return value : array, shape = F.shape[1:], the vertical slice
Example: H is an array of depths (positive values) Hc is the critical depth C is 1D containing the s-coordinate stretching at rho-points returns F50, interpolated values at 50 meter with F50.shape = H.shape
- Parameters:
F (numpy.typing.NDArray[numpy.float64])
S (numpy.typing.NDArray[numpy.float64])
z (Array)
- Return type:
numpy.typing.NDArray[numpy.float64]
- opendrift.readers.roppy.depth.multi_zslice(F, S, Z)[source]
Slice a 3D ROMS field to fixed depth
Vertical interpolation of a field in s-coordinates to fixed vertical level
F : array of with vertical profiles, first dimension is vertical
- Sarray with depth of s-levels (at rho-points)
1D (constant depth) or S.shape = F.shape
Z : single depth value, negative
Returns : array,
shape = F.shape[1:]the vertical slice
- opendrift.readers.roppy.depth.z_average(F, z_r, z0, z1)[source]
Slice a 3D ROMS field to fixed depth
Vertical interpolation of a field in s-coordinates to fixed vertical level
- Farray
Vertical profiles, first dimension is vertical
- z_rarray
Depth of s-levels (at rho-points), requires z_r.shape = F.shape
- z0, z1floats
Single depth values with z0 <= z1 <= 0
- return valuearray
shape = F.shape[1:], the vertical average
- opendrift.readers.roppy.depth.s_stretch(N, theta_s, theta_b, stagger='rho', Vstretching=1)[source]
Compute a s-level stretching array
N : Number of vertical levels
theta_s : Surface stretching factor
theta_b : Bottom stretching factor
stagger : “rho”|”w”
Vstretching : 1|2|3|4|5
- Parameters:
N (int)
theta_s (float)
theta_b (float)
stagger (str)
Vstretching (int)
- Return type:
numpy.typing.NDArray[numpy.float64]