clear;

load data/flux_10m_dat.mat
m_wt_10=m_wt;
m_wq_10=m_wq;
m_wu_10=m_wu;
m_wv_10=m_wv;

load data/flux_05m_dat.mat

nt=6;
time=mean(reshape(m_time,nt,[]),1);
wt_05=mean(reshape(m_wt,nt,[]),1);
wt_10=mean(reshape(m_wt_10,nt,[]),1);
wq_05=mean(reshape(m_wq,nt,[]),1);
wq_10=mean(reshape(m_wq_10,nt,[]),1);
wu_05=mean(reshape(m_wu,nt,[]),1);
wu_10=mean(reshape(m_wu_10,nt,[]),1);
wv_05=mean(reshape(m_wv,nt,[]),1);
wv_10=mean(reshape(m_wv_10,nt,[]),1);


k1=subplot(2,2,1);
plot(time,-wt_05*1.15*1004);
hold on;
plot(time,-wt_10*1.15*1004,'r');
h=legend('z=5 m','z=10 m');
set(h,'box','off','location','northwest');
axis([0,24,-50,150]);
set(gca,'xtick',[0:6:24]);
h=title('Sensible heat flux (W/m^2)');
set(h,'fontweight','normal');
hold off;

k2=subplot(2,2,2);
plot(time,-wq_05*1.15*2500000);
hold on;
plot(time,-wq_10*1.15*2500000,'r');
axis([0,24,-100,450]);
set(gca,'xtick',[0:6:24]);
h=title('Latent heat flux (W/m^2)');
set(h,'fontweight','normal');
hold off;

k3=subplot(2,2,3);
plot(time,-wu_05*1.15);
hold on;
plot(time,-wu_10*1.15,'r');
axis([0,24,-1.6,0.2]);
set(gca,'xtick',[0:6:24]);
h=title('Along-wind momentum flux (kg/ms^2)');
set(h,'fontweight','normal');
xlabel('Local time (h)');
hold off;

k4=subplot(2,2,4);
plot(time,-wv_05*1.15);
hold on;
plot(time,-wv_10*1.15,'r');
axis([0,24,-0.08,0.4]);
set(gca,'xtick',[0:6:24]);
h=title('Cross-wind momentum flux (kg/ms^2)');
set(h,'fontweight','normal');
xlabel('Local time (h)');
hold off;

set(k1,'position',[0.06 0.57 0.43,0.38]);
set(k2,'position',[0.55 0.57 0.43,0.38]);
set(k3,'position',[0.06 0.09 0.43,0.38]);
set(k4,'position',[0.55 0.09 0.43,0.38]);

print -dpng flux_diur

