load('\\atlas.shore.mbari.org\ProjectLibrary\901805_Coastal_Biogeochemical_Sensing\Spray_Data\25202901\QC\25202901_QC.mat')

%

% Make datetime
s.dt = datetime(datevec(s.sdn),"TimeZone","UTC");

%
%% Overview of deployment
% Standard new pH sensor deployment stepping from 200m dives down to 1000 m while monitoring for any spikes or anomalies in the data. Specifically the diagnostics ik, ib, vk.
% After the first dives to 1000 m, spikes in vk were noticed and we returned to to shallower depths. The 1000 m dives were repeated to confirm the issue and then it was decided to remain shallow until data stabilized. Once stable the glider continued 500 m dives until recovery.
%

% Depth profile
fig1 = figure;
tl1 = tiledlayout(1,1);

nexttile(tl1)
scatter(s.dt(10:end),s.depth(:,10:end),'k.')
title('depth profile')

%

% Vk
fig2 = figure;
tl2 = tiledlayout(1,2);

nexttile(tl2)
scatter(s.vk(:,10:end),s.depth(:,10:end),ColorVariable=s.sdn,Marker='.')
title('vk vs depth')

nexttile(tl2) % maybe detrend then do this...
scatter(s.vk(:,10:end)-s.vk(1,10:end),s.depth(:,10:end),ColorVariable=s.sdn,Marker='.')
% scatter(detrend(s.vk(:,10:end)),s.depth(:,10:end),ColorVariable=s.sdn,Marker='.')
title('vk vs depth (start point removed)')

%

fig3 = figure;
tl3 = tiledlayout(1,1);

nexttile(tl3)
scatter(s.dt(10:end),s.vk(:,10:end),'k.')
hold on;

yyaxis right
scatter(s.dt(10:end),s.Ik(:,10:end),'b.')

legend('vk','ik')

%

fig4 = figure;
tl4 = tiledlayout(1,1);

nexttile(tl4)