Learn R Programming

oce (version 0.1-75)

sw.N2: Seawater square of buoyancy frequency

Description

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

Usage

sw.N2(p, sigma.theta=NULL, ...)

Arguments

p
either pressure [dbar] (in which case sigma.theta must be provided) or an object of class ctd object (in which case sigma.theta is inferred from the object.
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)/5.

Value

  • Square of buoyancy frequency [radian/s].

Details

If the first argument is a ctd object, then sigma.theta 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, 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)/5 as an optional argument to N2 to do some smoothing of the density profile.

Examples

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

Run the code above in your browser using DataLab