RSKtrim.m
Arguments
Input
-Required-
RSK
reference
: channel that determines which samples will be in the range and trimmed. To trim according to time, use 'time', or, to trim by index, choose 'index'.range
: 2 element vector of minimum and maximum values to trim
-Optional-
profile
: vector of profile numbers (defaults to all profiles).direction
: up, down, both (default).channel
: channels that apply the flag to.action
: NaN (default), remove, interpvisualize
: show plot with original, processed and flagged data on specified profile(s)
Output
RSK
The function removes or replaces values that fall in a certain range.
The argument input `reference` could be a channel name (e.g. sea pressure), `time`, or `index`. The following input `range` is a 2 element vector of minimum and maximum values. The samples in `reference` that fall within the range (including the edge) will be trimmed. When `reference` is `time`, the range must be in MATLAB datenum format. When `reference` is `index`, obviously the range must be integer numbers.
The function provides three methods to deal with flagged data, which are:
- `NaN` - replace flagged samples with NaN
- `remove` - remove flagged samples
- `interp` - replace flagged samples with interpolated values by neighbouring points.
Examples:
% Replace data acquired during a shallow surface soak with NaN
rsk = RSKtrim(rsk, 'reference', 'sea pressure', 'range',[-1 1], 'action', 'NaN');
% Remove data before 2019-01-01
rsk = RSKtrim(rsk, 'reference', 'time', 'range', [-inf datenum([2019 01 01 00 00 00])], 'action', 'remove');