forked from gabrielapilo/ArgoRealTimeSource
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfindspike.m
executable file
·39 lines (30 loc) · 1 KB
/
findspike.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% FINDSPIKE Argo prescribed spike tests (test 9)
%
% INPUT: vv - a profile of T or S
% p - corresponding pressures
% var - 't' or 's'
%
% OUTPUT: b1 - index to spikes by test 9
%
% CSIRO/BoM Aug 2006, updated Dec 2017.
%
% USAGE: b1 = findspike(vv,p,var);
function b1 = findspike(vv,p,var)
b1 = [];
lv = length(vv);
% Test9
% testv is distance of v(n) outside the range of values v(n+1) and v(n-1).
% If -ve, v(n) is inside the range of those adjacent points.
if lv>=3
jj = 2:(lv-1);
testv = abs(vv(jj) - (vv(jj+1)+vv(jj-1))/2) - abs((vv(jj+1)-vv(jj-1))/2);
if strfind(lower(var),'t')
b1 = find((p(jj)<500 & testv>6) | (p(jj)>=500 & testv>2)) + 1;
elseif strfind(lower(var),'s')
b1 = find((p(jj)<500 & testv>.9) | (p(jj)>=500 & testv>.3)) + 1;
elseif strfind(lower(var),'o')
b1 = find((p(jj)<500 & testv>50) | (p(jj)>=500 & testv>25)) + 1;
end
end
return
%---------------------------------------------------------------------------