Example matlab script for salinity calibration#

From the script portasal_cndr_example.m received from Tore Hattermann.

% example for salinity calibration of a few bottle samples from the CTD Rosette
%
% The Portasal instrument compares the conductivity ratio of the sample with
% the conductivity ratio of the standard seawater sample, which for a
% standard of 35 psu at 15 degC is 1:
% https://osil.com/2019/03/21/iapso-standard-seawater-and-the-practical-salinity-scale/
%
% To obtain maximum accuracy measurements, the instrument should be
% "standardized" according to the user manual every time after environment conditions have changed
% (initial installation and power up in the lab, temperature changes,
% etc.). In this procedure, the scale of the instrument is adjusted to assure that it
% reads the defined conductivity of a given control sample.
%
% This step was not performed on our cruise (I think), instead, we directly measured the
% conductivity ratio of the standard sample and use that to scale the
% conductivity ratio readings of the other samples. Luckily, the control
% sample in the below case seems to yield a ratio of nearly 1 within the measurement accuracy (last two digits),
% which indicates that the instrument was still well standardized, albeit for a different
% temperature. In this case our correction step is not very relevant and we can trust the obtained conductivity ratios
% to be truly representative of the sample and the control.
%
% For that case, the conductivity ratio can be used directly within e.g.
% the seawater function sw_salt that converts conductivity ratio into
% practical salinity
%
% For the case where the standardization is sub-optimal (i.e. the control sample measurement deviates from unity)
% the following procedure can be used to scale the sample conductivity ratio based on the measured conductivity ratio
% of the control sample.
%
% In both cases you will need to know and account for the bath temperature, which was,
% which was 23 degC in our case. This needs accounting for in the sw_salt routine of the matlab seawater
% package, as shown below.

% Example calibration for five bottle samples:

k15 = 0.99987; % Portasal measured conductivity ratio of the control sample
s15 = 35; % salinity of control sample
T_bath = 23; % temperature of the bath in our case

% Portasal measured conductivity ratios of samples
SM = [
53    1544        1000      0.9918    0.9919    0.9918
53    1545        600       0.9917    0.9918    0.9919
53    1546        75        0.9849    0.9853    0.9850
53    1547        25        0.9773    0.9767    0.9763];

% Method 1, via conversion onto absolute conductivity
C0 = (sw_cndr(35,T_bath,0)*sw_c3515)/k15; % absolute conductivity of control sample
C = C0.*SM(:,4:6); % absolute conductivities of samples
S = sw_salt(C/sw_c3515,T_bath*ones(size(C)),0*ones(size(C))); %salinity of the samples

% Method 2, via the temperature dependent conductivity ratio function
% within matlab
S0 = sw_salt(SM(:,4:6)*sw_salrt(T_bath)/k15,T_bath*ones(size(C)),0*ones(size(C))); %salinity of the samples

% Comparing the values obtained by this method with values obtained when
% setting k15=1 (assuming an ideally standardized Poratasal) shows the
% influence of the applied correction that I discussed above.
% Varying k15 in the range of the control sample measurements from the different batches of bottle samples
% should give a feeling for the overall uncertainty of our measurement.

% The functions in seawater are corresponding to gsw_SP_salinometer (=sw_salt), gsw_R_from_SP (=sw_cndr),
% and  gsw_C3515 (sw_c3515), in the gsw package. Couldn’t find the corresponding function to: sw_salrt.