sw.N2 {oce} | R Documentation |
Compute N^2, the square of the buoyancy frequency for a seawater profile.
sw.N2(p, sigma.theta=NULL, ...)
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] |
... |
optional extra arguments to be passed to
smooth.spline . See 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, 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,
sw.N2
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.)
Square of buoyancy frequency [radian^2/s^2].
Dan Kelley
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()