RSKcalculateCTlag.m

Arguments

Input

 -Required- 

  • RSK

-Optional-

  • pressureRange : [0, max(Pressure)] (default)
  • profile : [ ] (all profiles default).
  • direction : up, down or both.
  • windowLength : 21 (default)

Output

  • lag

This function estimates the optimal conductivity time shift relative to temperature in order to minimise salinity spiking.  The algorithm works by computing the salinity for conductivity lags of -20 to 20 samples at 1 sample increments.  The optimal lag is determined by constructing a high-pass filtered version of the salinity time series for every lag, and then computing the standard deviation of each. The optimal lag is the one that yields the smallest standard deviation.

The pressureRange argument allows for the possibility of estimating the lag on specific sections of the profile.  This can be useful when unreliable measurements near the surface are found to impact the optimal lag, or when the profiling speed is highly variable.

The lag output by RSKcalculateCTlag is compatible with the lag input argument for RSKalignchannel when lagunits is specified as samples in RSKalignchannel.

Example:

rsk = RSKopen('file.rsk');
rsk = RSKreadprofiles(rsk, 'profile', 1:10, 'direction', 'down');

% 1. All downcast profiles with default smoothing
lag = RSKcalculateCTlag(rsk);
% 2. Specified profiles (first 4), reference salinity found with 13 pt boxcar.
lag = RSKcalculateCTlag(rsk, 'profile',1:4, 'windowLength',13);