disp('epicz_weller_daily');
   %************************  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
   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);
%STRATUS 2006 JD 288 missing due to PC problem
%Set data to nan for that day
%hnd(1,6) =nan;
%rsd(1,6) =nan;
%hsd(1,6) =nan;
%hld(1,6) =nan;
%rnld(1,6) =nan;
%rld(1,6) =nan;


% AMMA2007 bad PSP and PIR on JD 123,124  DEW 5/19/2007
hnd(1,1) =nan;
rsd(1,1) =nan;
hsd(1,1) =nan;
hld(1,1) =nan;
rnld(1,1) =nan;
rld(1,1) =nan;

hnd(1,2) =nan;
rsd(1,2) =nan;
hsd(1,2) =nan;
hld(1,2) =nan;
rnld(1,2) =nan;
rld(1,2) =nan;


%jj=find(latd<15);
% Julian day 288 is just a partial day and it affects the means
%Not sure what these lines do, but I comments them out DEW 20 Oct 2006
 %jj=find(jdd>167.5 & jdd<175);rsd(jj)=NaN;rsclrd(jj)=NaN;rld(jj)=NaN;rlclrd(jj)=NaN;raind(jj)=NaN;hsd(jj)=NaN;hld(jj)=NaN;rnld(jj)=NaN;
 %jj=find(jdd>192.5);rsd(jj)=NaN;rsclrd(jj)=NaN;rld(jj)=NaN;rlclrd(jj)=NaN;
%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(['Year Day (2006 )']);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 -400 100]);xlabel(['Julian Day (UTC)']);
ylabel('Cloud Forcing (W/m^2)'); 
title('AMMA 2007 SW(o) LW(x)')
print_buffer = ['F:\AMMA_2007\RHB\flux\Processed_Images\AMMA07_FLUX_CloudForcing.jpg'];
print('-djpeg90 ', print_buffer);

figure;
h=plot(jdd,hnd,'-x',[stdt endt],[0 0 ]);
set(gca,'fontsize',14);set(h,'LineWidth',2);
axis([stdt endt -300 200]);
xlabel(['Year Day (2007)']);
ylabel('Net Heat Flux (W/m^2)');
title(tit)
print_buffer = ['F:\AMMA_2007\RHB\flux\Processed_Images\AMMA07_FLUX_Net.jpg'];
print('-djpeg90 ', print_buffer);

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 -100 300]);
xlabel(['Julian Day (UTC)']);
ylabel('Heat Flux Components (W/m^2)');  
title('AMMA 2007 SWm(cir) Hsen(dia) Hlat(tri) Net(x)')
print_buffer = ['F:\AMMA_2007\RHB\flux\Processed_Images\AMMA07_FLUX_SW_hs_Hl_net.jpg'];
print('-djpeg90 ', print_buffer);