% Hsnointerp=load('C:\Data\CRUISES\DYNAMO_2011\data\Riegl_corrected\Riegl_nointerpolation\Hs_all_nointerp.prn');
Hs_wave2heavespline=load('C:\Data\CRUISES\DYNAMO_2011\data\Riegl_corrected\Riegl_wavesplineinterpolated2motion\Hs_all_wavesplineinterpolated2motion.prn');
% ludmat=[hhh sig_wave_ht sig_wavecorrected_ht lagflag];
Hs_wave2heavelinear=load('C:\Data\CRUISES\DYNAMO_2011\data\Riegl_corrected\Riegl_wavelinearinterpolated2motion\Hs_all_wavelinearinterpolated2motion.prn');
Hs_heave2wavespline=load('C:\Data\CRUISES\DYNAMO_2011\data\Riegl_corrected\Riegl_heavesplineinterpolatedtowave\Hs_all_heavesplineinterpolatedtowave.prn');


figure;plot(Hs_heave2wavespline(:,1),Hs_heave2wavespline(:,2),'b.--',Hs_wave2heavespline(:,1),Hs_wave2heavespline(:,2),'r-')


% for ddd=311:341
%     jd=sprintf('%03i',ddd);
%     filecat(['C:\Data\CRUISES\DYNAMO_2011\data\Riegl_corrected\Riegl_heavesplineinterpolatedtowave_v012012_leg3\Hs_' jd '*.prn'],['Hs_doy' jd '.txt']);
% end
% filecat(['C:\Data\CRUISES\DYNAMO_2011\data\Riegl_corrected\Riegl_heavesplineinterpolatedtowave_v012012_leg3\Hs_doy*.txt'],['Hs_hourly_leg3.prn']);
Hs_heave2wavespline_leg3=load('C:\Data\CRUISES\DYNAMO_2011\data\Riegl_corrected\Riegl_heavesplineinterpolatedtowave_v012012_leg3\Hs_hourly_leg3.prn');

figure;plot(Hs_heave2wavespline(:,3),'b.--'); hold on;plot(Hs_heave2wavespline_leg3(:,4),'r-')

doy_leg3=Hs_heave2wavespline_leg3(:,1)+Hs_heave2wavespline_leg3(:,2)/24;
figure;plot(doy_leg3,Hs_heave2wavespline_leg3(:,3),'b.--',doy_leg3,Hs_heave2wavespline_leg3(:,4),'r-')

doy_leg3=doy_leg3+datenum(2011,1,0);%julian day to Matlab format

% ii=find(abs(Hs_heave2wavespline_leg3(:,7))<0.1);   %finds nanmean(wave)>0.1
ii=find(abs(Hs_heave2wavespline_leg3(:,7))<0.06  & abs(Hs_heave2wavespline_leg3(:,5))<1 & Hs_heave2wavespline_leg3(:,6) >10);


x=load(['S:\cruises\DYNAMO_2011\Revelle\flux\Processed\leg3\DYNAMO_2011_PSD_flux_5min_leg3.txt']);
jdy=x(:,1)+datenum(2011,1,0);%julian day to Matlab format
% jdy=jdy+datenum(Vdate(1),1,0);  %converts time to Serial Date Number
U=x(:,2);%true wind,PSD sonic (m/s)
stdt=floor(jdy(1));
endt=ceil(jdy(end)); 
xs=2;  %defines spacing for plot on x-axis
cruise='DYNAMO_2011';

figure;
set(gcf,'defaultaxesfonts',12)
set(gca,'fontname','time','fontsize',12);
    subplot(2,1,1);plot(jdy,U,'b','LineWidth',2);
xlim([stdt endt]);ylabel('WS (ms^{-1})');
title(sprintf('%s - leg3.  5-min wind speed',cruise),'FontWeight','Bold','Interpreter','none')
set(gca(gcf),'XTick',stdt:xs:endt);datetick('x','mm/dd','keepticks','keeplimits');
grid on;%grid minor

    subplot(2,1,2);plot(doy_leg3(ii),Hs_heave2wavespline_leg3(ii,3),'b.--',doy_leg3(ii),Hs_heave2wavespline_leg3(ii,4),'r-','LineWidth',2)
legend('Uncorrected', 'Corrected','location','NorthWest');
ylabel('Hs (m)');
title(sprintf('%s - leg3.  Hourly significant wave height',cruise),'FontWeight','Bold','Interpreter','none')
axis([stdt endt 0 8]);
set(gca(gcf),'XTick',stdt:xs:endt);datetick('x','mm/dd','keepticks','keeplimits');
grid on;%grid minor
