Learn R Programming

oce (version 0.1.63)

sw.N2: Seawater square of buoyancy frequency

Description

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

Usage

buoy.freq.2 <- sw.N2(p, sigma.theta, ...)

Arguments

p
in-situ pressure [dbar]
sigma.theta
Surface-referenced potential density minus 1000 [kg/m$^3$]
...
Extra arguments that will be passed to smooth.spline if supplied. A common example is to set df, the degrees of freedom for the spline fit; if not set, this will be set to the value length(p)/4.

Value

  • Square of buoyancy frequency [radian/s].

Details

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, and this gives the user a great deal of control over the smoothing technique; see the documentation on smooth.spline for details. For example, plot.profile uses df=length(x$p)/4 as an optional argument to N2 to do some smoothing of the density profile.

Examples

Run this code
library(oce)
data(ctd)
p <- ctd$data$pressure
sigthe <- sw.sigma.theta(ctd$data$temperature, ctd$data$salinity, ctd$data$pressure)
par(mfcol=c(3,1))
plot(sigthe, -p)
lines(sigthe, -p)
plot(sw.N2(p,sigthe), -p)
lines(sw.N2(p,sigthe), -p)
abline(v=0)
# Demonstrate the effect of the df parameter in smooth.spline()
lines(sw.N2(p,sigthe,df=length(p)/4), -p)
abline(v=0)

Run the code above in your browser using DataLab