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

Functions

sdepth(H, zeta, Hc, C[, stagger, Vtransform])

Depth of s-levels

sdepth_w(H, Hc, cs_w)

Return depth of w-points in s-levels

zslice(F, S, z)

Vertical slice of a 3D ROMS field

multi_zslice(F, S, Z)

Slice a 3D ROMS field to fixed depth

z_average(F, z_r, z0, z1)

Slice a 3D ROMS field to fixed depth

s_stretch(N, theta_s, theta_b[, stagger, Vstretching])

Compute a s-level stretching array

s_stretch_w(N, theta_s, theta_b[, Vstretching])

Obsolete use s_stretch instead

Module Contents

opendrift.readers.roppy.depth.sdepth(H, zeta, Hc, C, stagger='rho', Vtransform=1)[source]

Depth of s-levels

Harraylike

Bottom depths [meter, positive]

zetascalar, arraylike

Surface elevation [meter]

Hcscalar

Critical depth

cs_r1D array

s-level stretching curve

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:

.. code::

fid = Dataset(roms_file) H = fid.variables[‘h’][:, :] zeta = fid.variables[‘zeta’][:, :] C = fid.variables[‘Cs_r’][:] Hc = fid.variables[‘hc’].getValue() z_rho = sdepth(H, zeta, Hc, C)

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

S : array with depths of the F-values,

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

z_rho = sdepth(H, Hc, C)
F50 = zslice(F, z_rho, -50.0)
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|4

opendrift.readers.roppy.depth.s_stretch_w(N, theta_s, theta_b, Vstretching=1)[source]

Obsolete use s_stretch instead