Calculate salinity from what is actually measured by a CTD, *i.e.*
conductivity, *in-situ* temperature and pressure. Often this is done
by the CTD processing software, but sometimes it is helpful to do this
directly, *e.g.* when there is a concern about mismatches in sensor
response times.

```
swSCTp(
conductivity,
temperature = NULL,
pressure = NULL,
conductivityUnit,
eos = getOption("oceEOS", default = "gsw")
)
```

- conductivity
a measure of conductivity (see also

`conductivityUnit`

) or an`oce`

object holding hydrographic information. In the second case, all the other arguments to`swSCTp`

are ignored.- temperature
*in-situ*temperature (\(^\circ\)C), defined on the ITS-90 scale; see “Temperature units” in the documentation for`swRho()`

.- pressure
pressure (dbar).

- conductivityUnit
string indicating the unit used for conductivity. This may be

`"ratio"`

or`""`

(meaning conductivity ratio),`"mS/cm"`

or`"S/m"`

. Note that the ratio mode assumes that measured conductivity has been divided by the standard conductivity of 4.2914 S/m. In dealing with unfamiliar data for which the measurement unit has not been recorded, it can be sensible to try all three possibilities for`conductivityUnit`

, to see which yields the most sensible salinities.- eos
equation of state, either

`"unesco"`

or`"gsw"`

.

Practical Salinity.

Two variants are provided. First, if `eos`

is
`"unesco"`

, then salinity is calculated using
the UNESCO algorithm described by Fofonoff and Millard (1983) as in
reference 1. Second, if `eos`

is `"gsw"`

, then the
Gibbs-SeaWater formulation is used, via `gsw::gsw_SP_from_C()`

in the gsw package. The latter starts with the same formula
as the former, but if this yields a Practical Salinity less than 2,
then the result is instead calculated using
formulae provided by Hill et al. (1986; reference 2), modified to match the
`"unesco"`

value at Practical salinity equal to 2 (reference 3).

Fofonoff, P. and R. C. Millard Jr, 1983. Algorithms for computation of fundamental properties of seawater.

*Unesco Technical Papers in Marine Science*,*44*, 53 pp.K. Hill, T. Dauphinee, and D. Woods. “The Extension of the Practical Salinity Scale 1978 to Low Salinities.” IEEE Journal of Oceanic Engineering 11, no. 1 (January 1986): 109-12. doi:10.1109/JOE.1986.1145154

`gsw_from_SP`

online documentation, available at`http://www.teos-10.org/pubs/gsw/html/gsw_C_from_SP.html`

For thermal (as opposed to electrical) conductivity, see
`swThermalConductivity()`

. For computation of electrical
conductivity from salinity, see `swCSTp()`

.

Other functions that calculate seawater properties:
`T68fromT90()`

,
`T90fromT48()`

,
`T90fromT68()`

,
`computableWaterProperties()`

,
`locationForGsw()`

,
`swAbsoluteSalinity()`

,
`swAlphaOverBeta()`

,
`swAlpha()`

,
`swBeta()`

,
`swCSTp()`

,
`swConservativeTemperature()`

,
`swDepth()`

,
`swDynamicHeight()`

,
`swLapseRate()`

,
`swN2()`

,
`swPressure()`

,
`swRho()`

,
`swRrho()`

,
`swSR()`

,
`swSTrho()`

,
`swSigma0()`

,
`swSigma1()`

,
`swSigma2()`

,
`swSigma3()`

,
`swSigma4()`

,
`swSigmaTheta()`

,
`swSigmaT()`

,
`swSigma()`

,
`swSoundAbsorption()`

,
`swSoundSpeed()`

,
`swSpecificHeat()`

,
`swSpice()`

,
`swSstar()`

,
`swTFreeze()`

,
`swTSrho()`

,
`swThermalConductivity()`

,
`swTheta()`

,
`swViscosity()`

,
`swZ()`

```
# 1. Demonstrate agreement with test value in UNESCO documents
swSCTp(1, T90fromT68(15), 0, eos="unesco") # expect 35
#> [1] 35
# 2. Demonstrate agreement of gsw and unesco, S>2 case
swSCTp(1, T90fromT68(15), 0, eos="gsw") # again, expect 35
#> [1] 35
# 3. Demonstrate close values even in very brackish water
swSCTp(0.02, 10, 100, eos="gsw") # 0.6013981
#> [1] 0.6013981
swSCTp(0.02, 10, 100, eos="unesco") # 0.6011721
#> [1] 0.6011721
```