clear all
load ArgosAndESRL/ArgosS14dep
T1 = datenum(2015,4,22,0,0,0);
T2 = datenum(2015,4,22,19,0,0);
n1=find(sys1.mday>T1 & sys1.mday<T2);
n2=find(sys2.mday>T1 & sys2.mday<T2);

figure(1), clf
plot(sys1.mday(n1), sys1.wndd(n1), '.-', sys2.mday(n2),sys2.wndd(n2),'.-r')

correction = 'uncorrected';
if strcmp(correction,'uncorrected')
load ArgosAndESRL/esrlflux
% hourly averaging
[mewnde, mte] = navdata(esrl.wnde', datevec(esrl.mday'), 4);
[mewndn, mte] = navdata(esrl.wndn', datevec(esrl.mday'), 4);
elseif strcmp(correction,'corrected')
load swnd
% hourly averaging
[mewnde, mte] = navdata(swnd.u', datevec(swnd.mday'), 4);
[mewndn, mte] = navdata(swnd.v', datevec(swnd.mday'), 4);
end
mte = mte+30/1440;
[mewspd, mewdir] = vect2md(mewnde, mewndn);
ne = find(mte>T1 & mte<T2);
hold on
plot(mte(ne), mewdir(ne), '.-g')
myticks(gca,1/24,4), grid on
title(['WDIR at Stratus 14 from WHOI buoy and ship''s ESRL (',correction,') and Vaisala  '])
% ne = find(esrl.mday>T1 & esrl.mday<T2);
% hold on
% plot(esrl.mday(ne), esrl.wndd(ne), '.-g')

load ship
[ship.wspd,junk,junk] = convert_knot(ship.wspd);
ship.wdir = mod(ship.wdir+180, 360);
[ship.wnde, ship.wndn]= md2vect(ship.wspd, ship.wdir);
[mswnde, mts] = navdata(ship.wnde', datevec(ship.mday'), 4);
[mswndn, mts] = navdata(ship.wndn', datevec(ship.mday'), 4);
mts = mts+30/1440;
[mswspd, mswdir] = vect2md(mswnde, mswndn);
ns = find(mts>T1 & mts<T2);

plot(mts(ns), mswdir(ns), '.-k')
legend('sys1','sys2','esrl','ship')

%% Same for WSPD
figure(2), clf
plot(sys1.mday(n1), sys1.wnds(n1), '.-', sys2.mday(n2),sys2.wnds(n2),'.-r')
hold on
plot(mte(ne), mewspd(ne), '.-g')
plot(mts(ns), mswspd(ns), '.-k')
myticks(gca,1/24,4), grid on
title(['WSPD at Stratus 14 from WHOI buoy and ship''s ESRL (',correction,') and Vaisala  '])
legend('sys1','sys2','esrl','ship')



