Learn R Programming

oce (version 0.8-3)

swN2: Squared buoyancy frequency for seawater

Description

Compute $N^2$, the square of the buoyancy frequency for a seawater profile.

Usage

swN2(pressure, sigmaTheta=NULL, derivs, ...)

Arguments

pressure
either pressure [dbar] (in which case sigmaTheta must be provided) or an object of class ctd object (in which case sigmaTheta is inferred from the object.
sigmaTheta
Surface-referenced potential density minus 1000 [kg/m$^3$]
derivs
optional function to replace the default calculation of the $d\sigma_\theta/dp$. Its first argument must be the actual pressure (i.e. it cannot be a CTD object) and the second must be sigmaTheta.
...
optional extra arguments to be passed to smooth.spline. See Details.

Value

  • Square of buoyancy frequency [$radian^2/s^2$].

Details

If the first argument is a ctd object, then sigmaTheta is inferred from it.

The result is calculated from the derivative of a smoothing cubic spline fitted to the density profile using smooth.spline. Optional arguments in ...are passed to this routine, providing the user with a good degree of control over the smoothing technique. A common method is to set df, the degrees of freedom for the spline fit. (Note that if df is not provided as an argument, swN2 will set it to min(length(p)/5, 10) to provide a result similar to what one might calculate by smoothing the density profile manually.)

Examples

Run this code
library(oce)
data(ctd)
# Illustrate effect of changing df
p <- pressure(ctd)
plot(swN2(ctd), p, ylim=rev(range(p)), xlab="N2",ylab="p", type='l')
lines(swN2(ctd, df=3), p, col="blue")
grid()

Run the code above in your browser using DataLab