zz=load('d:\cwf\data\epic2001\micro\micro_10m.txt');%10-min averaged mailbox microwave data
zx=load('d:\cwf\data\epic2001\micro\micro_min_90.txt');%10-min 90 ghz microwave data
yh=load('d:\cwf\data\epic2001\ceilo\epic2_ceilo_10min.txt');%10-min ceilometer


%start with ceilo data
jdycm=yh(:,1);			%julian day at beginning of time average
alldam=yh(:,2);			%total number of data points
nocldm=yh(:,3);			%clear sky points
onecldm=yh(:,4);		%one cloud layer points
mltcldm=yh(:,5);		%multiple cloud layer points
obscurem=yh(:,6);		%number of obscure points
pobsm=yh(:,7);			%number of partially obscure
clrfm=yh(:,8);			%clear sky fraction
ceilofm=yh(:,9);		%cloud fraction   
ceilofobsm=yh(:,10);	%cloud fraction with obscure
zbm=yh(:,11);			%cloud base height
zb1m=yh(:,12);			%cloud base height plus sigma
zb2m=yh(:,13);			%cloud base height minus sigma



%[jdav,y,yvar,nn]=timave_rawmicro(daty(:,1),10,daty);

%90 ghz data
clear x
x=interp1(zx(:,1),zx,jdycm);
jdy90=x(:,1);%julian day 10-min
nh=x(:,2);%# 21-s values used to compute 10-m val
ivh=x(:,3);%integrated water vapor, cm
ilh=x(:,4);%integrated liquid water, mm
tb20=x(:,5);
tb30=x(:,6);
tb90=x(:,7);

%mailbox
clear yx
ii=find(~isnan(zz(:,1)));
yx=interp1(zz(ii,1)-.0035,zz(ii,:),jdycm);
jdymail=yx(:,1);%julian day 10-min mailbox ghz data
iv=yx(:,2);%integrated water vapor, cm
il=yx(:,3);%integrated liqued water, cm
tau23=yx(:,4);%tau 20 hgz
tb23=yx(:,5);%T bright 20 ghz
tau31=yx(:,6);%tau 30 ghz
tb31=yx(:,7);%T bright 30 ghz

figure;plot(jdycm,tb20,jdycm,tb30,jdycm,tb90,jdycm,tb23,jdycm,tb31);

dst=291;figure;plot(jdycm,ceilofm,'-o',jdycm,il*10,jdycm,ilh/2,'.',[dst dst+1],[0 0]);axis([dst dst+1 -.20 1]);xlabel('Julian Day (2001)');ylabel('LWP (mm)');title('EPIC2001 Leg II: Mailbox=grn line, 21/31/90 =red dots');
dst=291;figure;plot(jdycm,zb1m,'x',jdycm,zbm,jdycm,zb2m,'+',[dst dst+1],[0 0]);axis([dst dst+1 400 1100]);xlabel('Julian Day (2001)');ylabel('CLoud Base Height (m)');title('EPIC2001 Leg II: ');


prt_it=1;  %set to 0 to print to screen, 1 to print to a file (i.e., make ascii file)
if prt_it==1   
   ss='d:\cwf\data\epic2001\micro\';
	e=[ss 'microceilo_10min.txt'];
   flist1=fopen([ss 'microceilo_10m.txt'],'w');
   else
 	flist1=1;flist2=1;
end;


daty=[jdycm ceilofm  zb1m zbm zb2m iv il*10 tb23 tb31 ivh ilh tb20 tb30 tb90]; 
%fprintf(flist1,'%12.6f %10.5f %10.5f \r',daty');
fprintf(flist1,'%12.6f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f  \r',daty');

fclose('all');
