Compute density ratio

swRrho(
ctd,
sense = c("diffusive", "finger"),
smoothingLength = 10,
df,
eos = getOption("oceEOS", default = "gsw")
)

## Arguments

ctd an object of class ctd an indication of the sense of double diffusion under study and therefore of the definition of Rrho; see ‘Details’ ignored if df supplied, but otherwise the latter is calculated as the number of data points, divided by the number within a depth interval of smoothingLength metres. if given, this is provided to smooth.spline(). equation of state, either "unesco" or "gsw".

## Value

Density ratio defined in either the "diffusive" or "finger" sense.

## Details

This computes Rrho (density ratio) from a ctd object.

If eos="unesco", this is done by calculating salinity and potential-temperature derivatives from smoothing splines whose properties are governed by smoothingLength or df. If sense="diffusive" the definition is $$(beta*dS/dz)/(alpha*d(theta)/dz)$$ and the reciprocal for "finger".

If eos="gsw", this is done by extracting absolute salinity and conservative temperature, smoothing with a smoothing spline as in the "unesco" case, and then calling gsw::gsw_Turner_Rsubrho() on these smoothed fields. Since the gsw function works on mid-point pressures, approx() is used to interpolate back to the original pressures.

If the default arguments are acceptable, ctd[["Rrho"]] may be used instead of swRrho(ctd).