# gsw_SA_CT_interp

`SA and CT interpolation to p_i on a cast`

## USAGE:

`[SA_i, CT_i] = gsw_SA_CT_interp(SA,CT,p,p_i)`

## DESCRIPTION:

```This function interpolates vertical casts of values of Absolute Salinity
and Conservative Temperature to the arbitrary pressures p_i.  The
interpolation method is designed to respect the shape of the SA-CT
diagram.  That is, the interpolated SA_i and CT_i values look realistic
when plotted on the SA-CT diagram.  The interpolation method uses
sixteen PCHIPs (Piecewise Cubic Hermite Interpolating Polynomials), one
for each of sixteen different linear combinations of the SA and CT input
data.  Each of these sixteen PCHIPs use the "bottle number" as the
independent variable.  A final seventeenth PCHIP is used to relate the
interpolated data back to pressure space (rather than "botttle number"
space).  The interpolation method is described as method MRST-PCHIP in
Barker and McDougall (2020). ```
```This function requires scaling the temperature and salinity data so that
the SA-CT diagram reflects the relative variation of temperature and
salinity in the world ocean.  A suitable value of the this scaling
parameter, factor, was found to be 9.  This scaling factor was chosen to
reflect the ratio of the global ranges of temperature and salinity in
the world ocean.  The interpolation technique performs well when this
scaling factor is between 3 to 25 with only small changes in the
resulting interpolated data, so the method is not particularly sensitive
to the value of "factor". ```
```Any interpolated bottles that have pressures shallower than the
shallowest observed bottle are set equal to the shallowest observed
bottle.```
```Note that this interpolation scheme requires at least four observed
bottles on the cast.```

## INPUT:

```SA   =  Absolute Salinity                                       [ g/kg ]
CT   =  Conservative Temperature                               [ deg C ]
p    =  sea pressure                                            [ dbar ]
( i.e. absolute pressure - 10.1325 dbar )
p_i  =  specific query points at which the interpolated SA_i and CT_i
are required                                            [ dbar ]```
```SA & CT need to have the same dimensions.
p may have dimensions Mx1 or 1xN or MxN, where SA & CT are MxN.
p_i needs to be either a vector or a matrix and have dimensions M_ix1
or M_ixN.```

## OUTPUT:

```SA_i =  interpolated SA values at pressures p_i                [ g/kg ]
CT_i =  interpolated CT values at pressures p_i               [ deg C ]
```

## EXAMPLE:

```SA  = [34.7118; 34.8915; 35.0256; 34.8472; 34.7366; 34.7324;]
CT  = [28.7856; 28.4329; 22.8103; 10.2600;  6.8863;  4.4036;]
p   = [     10;      50;     125;     250;     600;    1000;]
p_i = [     10;      50;     200;     500;     750;    1000;]```
`[SA_i, CT_i] = gsw_SA_CT_interp(SA,CT,p,p_i)`
`SA_i =`
```   34.7118
34.8915
34.9151
34.7520
34.7253
34.7324```
`CT_i =`
```   28.7856
28.4329
13.4287
7.5381
5.8243
4.4036```

## AUTHOR:

`Paul Barker and Trevor McDougall              [ help@teos-10.org ]`

## VERSION NUMBER:

`3.06.12 (25th June, 2020)`

## REFERENCES:

```Barker, P.M., and T.J. McDougall, 2020: Two interpolation methods using
multiply-rotated piecewise cubic hermite interpolating polynomials.
J. Atmosph. Ocean. Tech., 37, pp. 605-619.
doi: 10.1175/JTECH-D-19-0211.1.

```
`The software is available from http://www.TEOS-10.org`