disp(['epicz_daily: ' cruise]);
   %************************  daily averages  ***********	
 clear gd raind rsd rld rnld hnd ud hsd hld tsd tsgd jdd latd lond tad rlclrd rsclrd taud ux uy qsd qad orgd
   jj0=floor(jdq(1));
[nn,nx]=size(jdq);
mx=floor(jdq(nn))-jj0+1;jj=0;
for i=1:mx
   ii=find(floor(jdq)==jj0 & isfinite(U) & isfinite(hlb));
   jdd(i)=mean(jdy(ii));
   uxd(i)=mean(U(ii).*cos(pi/180*dir(ii)));
   uyd(i)=mean(U(ii).*sin(pi/180*dir(ii)));
   ud(i)=mean(U(ii));
   ugd(i)=mean(sqrt(U(ii).^2+wgust(ii).^2));
   sigud(i)=var(U(ii));
   raind(i)=mean(org(ii));
	rsd(i)=mean(rs(ii));
   rld(i)=mean(rl(ii));
   rnld(i)=mean(rlnet(ii));
	hnd(i)=mean(hnet(ii));
   ud(i)=mean(U(ii));
   hsd(i)=mean(hsb(ii));
   hld(i)=mean(hlb(ii));
   taud(i)=mean(taub(ii));
   tsd(i)=mean(tsnk(ii));
   tad(i)=mean(ta(ii));
   tsgd(i)=mean(tsg(ii));
   qsd(i)=mean(qse(ii));
   qad(i)=mean(qa(ii));
   latd(i)=mean(lat(ii));
   lond(i)=mean(lon(ii));
   rsclrd(i)=mean(Rscl(ii));
   rlclrd(i)=mean(rlclr(ii));
   gd(i)=mean(wgust(ii).^2);
   jj=min(jj+288,nn-1);
   jj0=floor(jdq(jj+1));   
end;
uv=sqrt(uxd.^2+uyd.^2);


%figure;plot(latd,rsd-rsclrd,'o',latd,rld-rlclrd,'x',[-10 12],[0 0 ]);set(gca,'fontsize',14);axis([-10 12 -250 100]);xlabel('Latitude (deg)');ylabel('Cloud Forcing (W/m^2)');   
%figure;h=plot(jdd,rsd-rsclrd,'-o',jdd,rld-rlclrd,'-x',[stdt endt],[0 0 ],jdd,24*raind,'-');set(gca,'fontsize',14);set(h,'LineWidth',2);axis([stdt endt -150 100]);xlabel(timelab);ylabel('Cloud Forcing (W/m^2)');   

figure;
h=plot(jdd,rsd-rsclrd,'-o',jdd,rld-rlclrd,'-x',[stdt endt],[0 0 ],'-');
set(gca,'fontsize',14);set(h,'LineWidth',2);
axis([stdt endt -250 100]);xlabel(['Day (UTC)']);
grid on;%grid minor
set(gca(gcf),'XTick',stdt:xtickspace:endt);datetick('x','mm/dd','keepticks','keeplimits');
ylabel('Cloud Forcing (Wm^-^2)'); 
title(sprintf('%s -%s',cruise, leg(1:end-1)),'FontWeight','Bold','Interpreter','none')
legend('SW','LW','Location','Best');
annotation(gcf,'textbox',[0.007154 0.01077 0.4498 0.02462],'String',{'NOAA/ESRL/PSD/Weather & Climate Physics'},'FontSize',6,'FitBoxToText','off','LineStyle','none'); 
if prtit; print(graphdevice,[way_proc_images_flux cruise '_CloudForcing_' leg(1:end-1) graphformat]); end;


figure;
h=plot(jdd,hnd,'-x',[stdt endt],[0 0 ]);
set(gca,'fontsize',14);set(h,'LineWidth',2);
axis([stdt endt -300 400]);
xlabel(['Day (UTC)']);
grid on;%grid minor
set(gca(gcf),'XTick',stdt:xtickspace:endt);datetick('x','mm/dd','keepticks','keeplimits');
ylabel('Net Heat Flux (Wm^-^2)');
title(sprintf('%s -%s',cruise,leg(1:end-1)),'FontWeight','Bold','Interpreter','none')
annotation(gcf,'textbox',[0.007154 0.01077 0.4498 0.02462],'String',{'NOAA/ESRL/PSD/Weather & Climate Physics'},'FontSize',6,'FitBoxToText','off','LineStyle','none'); 
if prtit; print(graphdevice,[way_proc_images_flux cruise '_Net_' leg(1:end-1) graphformat]); end;

figure;
h=plot(jdd,.95*rsd,'-o',jdd,hsd,'-d',jdd,hld,'-^',jdd,rnld,'-x',[stdt endt],[0 0 ]);
set(gca,'fontsize',14);set(h,'LineWidth',2);
axis([stdt endt -200 600]);
xlabel(['Day (UTC)']);
grid on;%grid minor
set(gca(gcf),'XTick',stdt:xtickspace:endt);datetick('x','mm/dd','keepticks','keeplimits');
ylabel('Heat Flux Components (Wm^-^2)');  
title(sprintf('%s -%s',cruise,leg(1:end-1)),'FontWeight','Bold','Interpreter','none')
legend('SWm','Hsen','Hlat','NetIR(x)','Location','NorthEast');
annotation(gcf,'textbox',[0.007154 0.01077 0.4498 0.02462],'String',{'NOAA/ESRL/PSD/Weather & Climate Physics'},'FontSize',6,'FitBoxToText','off','LineStyle','none'); 
if prtit; print(graphdevice,[way_proc_images_flux cruise '_SW_Hs_Hl_net_' leg(1:end-1) graphformat]); end;
