xoa.dyn.VerticalModes#
- class xoa.dyn.VerticalModes(n2, z=None, nmodes=5, bc='rigid', lat=None, zrange=None, n2min=1e-09, fmin=1e-05)[source]#
Vertical modes of water columns, to decompose and recompose profiles
The quasi-geostrophic vertical modes \(F_n(z)\) are computed from the stratification of each water column, with
xoa.core.modes: the first one is the barotropic mode, and the next ones are the baroclinic modes, that have more and more nodes and are slower and slower. Profiles of the currents, of the pressure or of the temperature are then split into the amplitudes of the modes withdecomp()and put back together withrecomp().Everything works with extra dimensions, like time or horizontal ones, and with dask, since the computations are done with
xarray.apply_ufunc(). The levels may vary in space, like with sigma coordinates, the levels that are below the bottom are missing, and the columns that have different depths have different modes.- Parameters:
n2 (xarray.DataArray) – Squared Brunt-Vaisala frequency in s-2 at the levels, with a vertical dimension. See
xoa.thermdyn.get_n2().z (None, xarray.DataArray) – Vertical coordinate of the levels, which defaults to the one of n2. It may vary in space, and its sign convention is given by its
positiveattribute, seexoa.coords.as_z().nmodes (int) – Number of modes, including the barotropic one
bc ({"rigid", "free"}) – Boundary condition at the surface: either a rigid lid, which has no speed for the barotropic mode, or a free surface.
lat (None, float, xarray.DataArray) – Latitudes, to compute the deformation radii. They default to the ones of the coordinates, if any.
zrange (None, tuple(float)) – Focus on a layer: only the levels between these two z values, positive up and thus negative in the ocean, are used, and the modes have no flux through the limits of the layer. Everything is missing outside of it.
n2min (float) – Minimal stratification in s-2, which is used in the unstable or mixed layers
fmin (float) – The deformation radii are missing where the absolute value of the Coriolis parameter is smaller than this value in s-1, like close to the equator.
- modes#
The modes, whose mean square over the water column is one, and which are positive at the surface, with the
modedimension first.- Type:
- c#
Speeds of the modes in m s-1, which are missing for the barotropic mode of the rigid lid.
- Type:
- rd#
Deformation radii in meters, which are the speeds divided by the Coriolis parameter, if the latitudes are known.
- Type:
None, xarray.DataArray
- dz#
Thickness of the layers, that are the weights of the integrals.
- Type:
Example
n2 = xoa.thermdyn.get_n2(ds.temp, ds.sal) vm = xoa.dyn.VerticalModes(n2, nmodes=5) amps = vm.decomp(ds.u) # Amplitudes of the modes baroclinic = vm.recomp(amps, modes=[1, 2]) # Part of the first baroclinic modes vm.rd.isel(mode=1) # First deformation radius
Methods
decomp(da[, nmodes])Decompose profiles into the amplitudes of the vertical modes
energy_share(u[, v])Get the share of the kinetic energy of each mode
recomp(amps[, modes])Recompose profiles from the amplitudes of the vertical modes
truncation_error(da, nmodes)Get the error of recomposing profiles with a limited number of modes