disp('efbmatch_30')
%1:toga coare date (yymmddhhmmss)
%2:Tdry port
%3:Twet port
%4:q port
%5:Tdry star
%6:Twet star
%7:q star
%8:Tir sea
%9:Tir sky
%10:Ts
%11: bung:1=in, 0=out


fclose('all');
clear all;
for jl=124:151
   
%for jl=124:132

jd=num2str(jl);
skip_it=0;
if skip_it==0
	jazx=zeros(11,1440);jazx1=zeros(11,48);
	f=['D:\cwf\efb_data\fbjas' jd  '.txt']
	flist=fopen(f,'r');
	jazx=fscanf(flist,'%g%g%g%g%g%g%g%g%g%g%g',[11,inf]);
end;%end skip read
[ax,bx]=size(jazx);%jazx
tn=60*24;%number of minutes in a day

%%%%%%%%**********   sonic loop
%fill in beginning empty spots 

for i=1:48;
   j=30*(i-1)+1;
   k=30*i;
   jazx1(:,i)=mean(jazx(:,j:k)')';
   jazx1(1,i)=jazx(1,j);
end;
	stux=jazx1(1,:);
	iyr=fix(stux/1e10);
	mon=fix(stux/1e8)-iyr*100;
	iday=fix(stux/1e6)-iyr*1e4-mon*100;
	ihr=fix(stux/1e4)-iyr*1e6-mon*1e4-iday*100;
   imin=fix(stux/100)-fix(stux/1e4)*100;
   [a,b]=size(imin);
   isec=zeros(a,b);
   timex=[iyr' mon' iday' ihr' imin' isec']';
   jad=juldayv(timex);
   jj=find(jad>137.47 & jad<138.156);
   jazx1(11,jj)=-1;
   
   ii=find(jazx1(11,:)==0);
   figure;plot(jad,jazx1(2,:),jad,jazx1(5,:),jad(ii),jazx1(10,ii),'o');ylabel('Temperatures(C)');xlabel('Julian Day (1999)');
   Title('CSIRO data: red=Ts (IR), blu=Ta(port), grn=Ta(star)');
   
   
prt_f=0;
%prt_f=input('append flux data file? 0=n, 1=y');
np=bx;
if prt_f==1;
  prt_efb_30;
end;
end;