interpolation of a tracer to p_i on a cast



tracer_i = gsw_tracer_interp(tracer,p,p_i,{scale_factor})


This function interpolates vertical casts of values of tracer data 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). 
When the tracer is in-situ temperature we have found a suitable value 
for the scale_factor is 0.33, so that the final scaling factor is 0.33
times the maximum magnitude (over all data pairs) of the slope on the 
[tracer - bottle_number] diagram.  We expect 0.33 will be a suitable 
scale_factor for other tracer data. 
When values of Conservative Temperature are also available along with
each value of tracer data, a better interpolation code than the present
one is gsw_tracer_CT_interp(tracer,CT,p,p_i,factor).  
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    =  tracer                                                     [ ? ]
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 ]


 scale_factor = scaling factor of the maximum magnitude of the slope on 
               the [tracer - bottle_number] diagram.  The default value
                is 0.33.                                     [ unitless ]
p may have dimensions Mx1 or 1xN or MxN, where tracer is MxN.
p_i needs to be either a vector or a matrix and have dimensions M_ix1
or M_ixN.
scale_factor, if provided, must be a scalar.


tracer_i =  interpolated tracer values at pressures p_i [ ? ]


tracer   = [1.9190;  1.8955;  1.5207;  0.6840;  0.4591;  0.2936;]
p   = [     10;      50;     125;     250;     600;    1000;]
p_i = [     10;      50;     200;     500;     750;    1000;]
tracer_i = gsw_tracer_interp(tracer,p,p_i)
tracer_i =


Paul Barker and Trevor McDougall              [ ]


3.06.12 (25th June, 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