interpolation of in-situ temperature to p_i on a cast



t_i = gsw_t_interp(t,p,p_i)


This function interpolates vertical casts of values of in-situ temperature
to the arbitrary pressures p_i.
The interpolation method uses sixteen PCHIPs (Piecewise Cubic Hermite 
Interpolating Polynomials), one for each of sixteen different linear 
combinations of the tracer data and a scaled version of the independent 
variable.  Each of these sixteen PCHIPs use a scaled version of 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 the MR-PCHIP method in Barker and McDougall (2020). 
The scaling factor that we use for the independent variable is 0.33
times the maximum magnitude (over all data pairs) of the slope on the 
[CT - bottle_number] diagram.  With the oceanographic data that we have 
tested we have found that using multiplying factors between 0.1 and 1 
(instead of 0.33) also gave good interpolants, so the method is not 
sensitive to this choice of "scale_factor". 
The code uses Conservative Temperature (of TEOS-10) as the temperature 
variable in the interpolation procedure.  The output of the code is 
converted back to in-situ temperature.  The conversions between in-situ 
and Conservative Temperatures are done using the constant value of 
Absolute Salinity equal to the Standard Ocean Reference Salinity 
(35.16504 g/kg) which is found by calling gsw_SSO.  We have found that
the use of this salinity rather than the estimate salinity from 
MRST-PCHIP method in Barker and McDougall (2020) results in an 
temperature error less than 1 mK.
Any interpolated bottles that have pressures shallower than the 
shallowest observed bottle are set equal to the shallowest observed 
Note that this interpolation scheme requires at least four observed
bottles on the cast.


t    =  in-situ temperature (ITS-90)                           [ 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 ]
p may have dimensions Mx1 or 1xN or MxN, where t is MxN.
p_i needs to be either a vector or a matrix and have dimensions M_ix1
or M_ixN.


t_i =  interpolated in-situ temperature values at              [ deg C ]
       pressures p_i


t   = [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;]
t_i = gsw_t_interp(t,p,p_i)
t_i =


Paul Barker and Trevor McDougall              [ ]


3.06.12 (15th July, 2020)


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