RSKremoveloops.m

Arguments

Input

 -Required- 

  • RSK 

-Optional-

  • profile : [ ] (all profiles, default)
  • direction : up, down, or both.
  • threshold : 0.25 m/s (default) 
  • visualize: show plot with original, processed and flagged data on specified profile(s)

Output

  • RSK
  • flagidx : Index of the flagged values, organized in a structure with one field per data field

This function flags and replaces pressure reversals or profiling slowdowns with NaNs in the data field of the RSK structure and returns the index of these samples.  Variations in profiling rate are caused by, for example, profiling from a vessel in rough seas with a taut wire, or by lowering a CTD hand over hand.  If the ship heave is large enough, the CTD can momentarily change direction even though line is paying out, causing a "loop" in the velocity profile.  Under these circumstances the data can be contaminated because the CTD samples its own wake; this function is designed to minimise the impact from such situations.

First, this function low-pass filters the depth channel with a 3-point running average boxcar window to reduce the effect of noise. Second, it calculates the velocity using a simple two-point finite difference scheme and interpolates the velocity back on to the original timestamps. Lastly, it flags samples associated with a profiling velocity below the threshold value and replaces the corresponding points in all channels with NaN.  Starting from v2.2.0, any data points with reversed pressure (i.e. decreasing pressure during downcast or increasing pressure during upcast) will be flagged as well, to ensure that data with above threshold velocity in a reversed loop are removed.

The convention is for downcasts to have positive profiling velocity.  RSKremoveloops automatically accounts for the upcast velocity sign change.

Example:

rsk = RSKremoveloops(rsk)


Shown here are profiles of temperature (left panel) and profiling velocity (right panel). The red dash-dot line illustrates the threshold velocity; set in this example to 0.1 m/s. The temperature readings for which the profiling velocity was below 0.1 m/s are illustrated by the red dots.


The input RSK must contain a depth channel. (See RSKderivedepth.m)

While the depth channel is filtered by a 3-point moving average in order to calculate the profiling velocity, the depth channel in the RSK data structure is not altered.