% program to remove CTD spikes
% oc415-4 (Tracer 2)
% due to problems with the CTD wire, spikes were seen in 
% CTD casts 1:3

load ../process/oc415401
aa=find(s0<30);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

!mv ../process/oc415401.mat ../process/oc415401_spikey.mat
save ../process/oc415401  c0 chl par s0 t0 c1 o2 press s1 t1     

%%%%%%%%%%% cast 2
load ../process/oc415402
aa=find(s0<35 | s0 > 37);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

aa=find(press < 1);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

aa=find(t0 < 1);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

aa=find(s1<35 | s1 > 36.8);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

aa=find(t1 < 5);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

!mv ../process/oc415402.mat ../process/oc415402_spikey.mat
save ../process/oc415402  c0 chl par s0 t0 c1 o2 press s1 t1     


%%%%%%%%%% cast 3
load ../process/oc415403

aa=find(s0<35.21 | s0 > 36.8);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

aa=find(s1<35.21 | s1 > 36.8);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

aa=find(press < .5);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

aa=find(t0 < .5);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

aa=find(t1 < .5);
s0(aa)=[];
t0(aa)=[];
c0(aa)=[];
s1(aa)=[];
t1(aa)=[];
c1(aa)=[];
o2(aa)=[];
press(aa)=[];
chl(aa)=[];
par(aa)=[];

!mv ../process/oc415403.mat ../process/oc415403_spikey.mat
save ../process/oc415403  c0 chl par s0 t0 c1 o2 press s1 t1     
