R: Squared buoyancy frequency for seawater

swN2 {oce} | R Documentation

## 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, df, eos = getOption("oceEOS",
      default = "gsw"), debug = getOption("oceDebug"), ...)

### 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 argument to control how the derivative d(sigmaTheta)/d(pressure) is calculated. This may be a character string or a function of two arguments. See “Details”.
`df` | argument passed to `smooth.spline` if this function is used for smoothing; set to `NA` to prevent smoothing.
`eos` | equation of state, either `"unesco"` or `"gsw"`.
`debug` | an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many `oce` functions. Generally, setting `debug=0` turns off the printing, while higher values suggest that more information be printed. If one function calls another, it usually reduces the value of `debug` first, so that a user can often obtain deeper debugging by specifying higher `debug` values.
`...` | additional argument, passed to `smooth.spline`, in the case that `derivs="smoothing"`. See “Details”.

### Details

Smoothing is often useful prior to computing buoyancy frequency, and so this may optionally be done with `smooth.spline`, unless `df=NA`, in which case raw data are used. If `df` is not provided, a possibly reasonable value computed from an analysis of the profile, based on the number of pressure levels.

If `eos="gsw"`, then the first argument must be a `ctd` object, and processing is done with `gsw_Nsquared`, based on extracted values of Absolute Salinity and Conservative Temperature (possibly smoothed, depending on `df`).

If `eos="unesco"`, then the processing is as follows. The core of the method involves differentiating potential density (referenced to median pressure) with respect to pressure, and the `derivs` argument is used to control how this is done, as follows.

- if `derivs` is not supplied, the action is as though it were given as the string `"smoothing"`

- if `derivs` equals `"simple"`, then the derivative of density with respect to pressure is calculated as the ratio of first-order derivatives of density and pressure, each calculated using `diff`. (A zero is appended at the top level.)

- if `derivs` equals `"smoothing"`, then the processing depends on the number of data in the profile, and on whether `df` is given as an optional argument. When the number of points exceeds 4, and when `df` exceeds 1, `smooth.spline` is used to calculate smoothing spline representation the variation of density as a function of pressure, and derivatives are extracted from the spline using `predict`. Otherwise, density is smoothed using `smooth`, and derivatives are calculated as with the `"simple"` method.

- if `derivs` is a function taking two arguments (first pressure, then density) then that function is called directly to calculate the derivative, and no smoothing is done before or after that call.

For deep-sea work, the `eos="gsw"` option is the best scheme, because it uses derivatives of density computed with local reference pressure.

For precise work, it makes sense to skip `swN2` entirely, choosing whether, what, and how to smooth based on an understanding of fundamental principles as well as data practicalities.

### Value

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

### Author(s)

Dan Kelley

### See Also

Other functions that calculate seawater properties: `T68fromT90`, `T90fromT48`, `T90fromT68`, `swAbsoluteSalinity`, `swAlphaOverBeta`, `swAlpha`, `swBeta`, `swCSTp`, `swConservativeTemperature`, `swDepth`, `swDynamicHeight`, `swLapseRate`, `swPressure`, `swRho`, `swRrho`, `swSCTp`, `swSTrho`, `swSigma0`, `swSigma1`, `swSigma2`, `swSigma3`, `swSigma4`, `swSigmaTheta`, `swSigmaT`, `swSigma`, `swSoundAbsorption`, `swSoundSpeed`, `swSpecificHeat`, `swSpice`, `swTFreeze`, `swTSrho`, `swThermalConductivity`, `swTheta`, `swViscosity`, `swZ`

### Examples

    library(oce)
    data(ctd)
    # Illustrate difference between UNESCO and GSW
    p <- ctd[["pressure"]]
    ylim <- rev(range(p))
    par(mfrow=c(1,3), mar=c(3, 3, 1, 1), mgp=c(2, 0.7, 0))
    plot(ctd[["sigmaTheta"]], p, ylim=ylim, type='l', xlab=expression(sigma[theta]))
    N2u <- swN2(ctd, eos="unesco")
    N2g <- swN2(ctd, eos="gsw")
    plot(N2u, p, ylim=ylim, xlab="N2 Unesco", ylab="p", type="l")
    d <- 100 * (N2u - N2g) / N2g
    plot(d, p, ylim=ylim, xlab="N2 UNESCO-GSW diff. [%]", ylab="p", type="l")
    abline(v=0)

[Package oce version 1.0-1 Index]