disp('HiWinGS_2013_daily');
%% daily averages and mean cloud forcing plots

clear raind rsd rld rnld hnd ud hsd hld tsd tsgd tmxdd t5d jdd latd lond tad rlclrd rsclrd

jj0=floor(jdy(1));
[nn,nx]=size(jdy);
mx=floor(nn/144);
for i=1:mx
    ii=find(floor(jdy)==jj0);
    jdd(i)  =  nanmean1(jdy(ii));
    raind(i) = nanmean1(rain_best(ii));
    rsd(i)  =  nanmean1(rs_best(ii));
    rld(i)  =  nanmean1(rl_best(ii));
    rnld(i) =  nanmean1(rnl(ii));
    hnd(i)  =  nanmean1(hnet(ii));
    ud(i)   =  nanmean1(u_best(ii));
    hsd(i)  =  nanmean1(Hsbb(ii));
    hld(i)  =  nanmean1(Hlbb(ii));
    tsd(i)  =  nanmean1(ts_best(ii));
    tsgd(i) =  nanmean1(ts_best(ii));
    tmxdd(i)=  nanmean1(tmxd(ii));
    t5d(i)  =  nanmean1(dt5(ii));
    dtd(i)  =  nanmean1(dtw(ii));
    latd(i) =  nanmean1(Lat(ii));
    lond(i) =  nanmean1(Lon(ii));
    rsclrd(i)= nanmean1(Rscl(ii));
    rlclrd(i)= nanmean1(rlcler(ii));
    jj0=jj0+1;   
end;

%hnet = Rns+Rnl-hsb-hlb-rf;

figure;plot(latd,rsd./rsclrd,'-o');set(gca,'fontsize',14); grid;
axis([Latmin Latmax 0 1.1]);xlabel('Latitude (deg)');ylabel('Cloud Transmission Coef.');

jj=find(latd>Latmin);
figure;plot(1-rsd(jj)./rsclrd(jj),rld(jj)-rlclrd(jj),'o');set(gca,'fontsize',14); grid;
axis([0 1 0 100]);xlabel('1-Transmission Coeff.');ylabel('Measured-Clear IR Flux (W/m^2)');

figure;plot(rsclrd(jj)-rsd(jj),rld(jj)-rlclrd(jj),'o',[0 200],[0 80]);set(gca,'fontsize',14);
axis([0 200 0 100]);xlabel('SFC Solar Flux (W/m^2)');ylabel('SFC IR Flux (W/m^2)');	grid;

figure;plot(latd,rsd-rsclrd,'-o',latd,rld-rlclrd,'-x',[Latmin Latmax],[0 0 ]);set(gca,'fontsize',14);
axis([Latmin Latmax -150 100]);xlabel('Latitude (deg)');ylabel('Cloud Forcing (W/m^2)'); grid;
legend('shortwave', 'longwave','location','best');

figure;plot(jdd,rsd-rsclrd,'-o',jdd,rld-rlclrd,'-x',[stdt endt],[0 0 ],'k-');set(gca,'fontsize',14);
axis([stdt endt -100 100]);xlabel('Year Day (2014)'); ylabel('Cloud Forcing (W/m^2)'); grid;
legend('shortwave', 'longwave','location','best');

figure; plot(jdd, hnd,'bo-',[stdt,endt],[0,0],'k-'); set(gca,'fontsize',14);
xlim([stdt endt]); grid;
xlabel('Year Day (2014)');ylabel('Daily Avg Net Heat Flux (W/m^2)');
