disp('med_tau_plt');
%taucx=ytaucx;taucy=ytaucy;taub=ytaub;


%kk=find(abs(taucx-tauib)>.03+.01*v1);
% taucx(kk)=NaN;taucy(kk)=NaN;
clear uu taucxmm taucymm taubm tauibm  nm tauibmm tauibmx taucxmx taucymx taubmm taubmx dumx jamu jamux jamui
uu(1:13)=0:12;
uu(14:16)=14:2:18;uu(17)=24;
%uu(14:18)=14:2:22;
for i=1:16
   ii=find(v1>=uu(i) & v1<uu(i+1));
   jj=find(  isfinite(taucx(ii)) &  isfinite(taub(ii))&  isfinite(tauib(ii)) & (reldir(ii)>300 | reldir(ii)<60) & ushp(ii)<5 & tiltx(ii)<8 & Jm(ii)<1.5);
   if isempty(jj)
      taucxmm(i)=NaN;
      taucymm(i)=NaN;
      tauibmm(i)=NaN;
      taubmm(i)=NaN;
      taucxmx(i)=NaN;
      taucymx(i)=NaN;
      tauibmx(i)=NaN;
      taubmx(i)=NaN;
      nm(i)=0;
      dumx(i)=NaN;
      rhom(i)=NaN;
      gfmu(i)=NaN;
      jamu(i)=NaN;
      jamui(i)=NaN;
      jamux(i)=NaN;
      sigux(i)=NaN;
      sigui(i)=NaN;
   else
      taucxmm(i)=nanmedian(taucx(ii(jj)));
      taucymm(i)=nanmedian(taucy(ii(jj)));
      tauibmm(i)=nanmedian(tauib(ii(jj)));
   	taubmm(i)=nanmedian(taub(ii(jj)));
   	nm(i)=length(jj);
      dumx(i)=nanmean(v1(ii(jj)));%
      taucxmx(i)=nanmean(taucx(ii(jj)));
      taucymx(i)=nanmean(taucy(ii(jj)));
      tauibmx(i)=nanmean(tauib(ii(jj)));
      taubmx(i)=nanmean(taub(ii(jj)));
      rhom(i)=nanmedian(rhoair(ii(jj)));
      gfmu(i)=nanmedian(gf(ii(jj)));
      clear flx;
      flxu=[(taucx(ii(jj))+tauib(ii(jj)))'/2 ];
      flxux=[(taucx(ii(jj)))' ];flxui=[(+tauib(ii(jj)))' ];
      %flxux=sqrt(abs(flxux));
      flxui=sqrt(abs(flxui));
      flxxu=sortrows(flxu');flxxux=sortrows(flxux');flxxui=sortrows(flxui');
      nxu=length(flxxu);
      jlft=floor(max(.15*nxu,1));jrgt=floor(max(1,.85*nxu));
      sigu(i)=(flxxu(jrgt)-flxxu(jlft))/2;
      jamu(i)=nanmedian(flxu);
      jamux(i)=nanmean(flxu);
		sigux(i)=(flxxux(jrgt)-flxxux(jlft))/2;
      %jamux(i)=median(flxux);
      jamuxx(i)=mean(flxux);
		sigui(i)=(flxxui(jrgt)-flxxui(jlft))/2;
      jamui(i)=nanmedian(flxui);
      jamuxi(i)=nanmean(flxui);

   end;
end;
ii=find(nm>2);
figure;plot(taubmm(ii),taucxmm(ii),'o',taubmx(ii),taucxmx(ii),'x',taubmm(ii),tauibmm(ii),'d',taubmm(ii),taucymm(ii),'<',[-.10 1.5],[0 0],'--k',[-.10 1.5],[-0.1 1.5],'k');set(gca,'fontsize',13);axis([-.025 .35 -.075 .35]);xlabel('Bulk Streamwise Stress (Nm^{-2})');ylabel('Turb Streamwise Stress (Nm^{-2})');%title([jdollars  '  x-mean  o-median  diamond-ID'  ]);
legend('\tau_x median','\tau_x mean','=\tau_{id} median','\tau_y median')



%figure;semilogy(dumx,taubmm,dumx(ii),taucxmm(ii),dumx,taubmx,'x',dumx(ii),taucxmx(ii),'-x',dumx(ii),tauibmm(ii),'d',[0 22],[0 0]);set(gca,'fontsize',13);xlabel('U (m/s)');ylabel('Taux (N/m^2)');title([jdollars  '  x-mean  diamond- median ID']);axis([0 22 0 1.5]);
%figure;loglog(taubmm(ii),abs(taucxmm(ii)),'o',taubmx(ii),abs(taucxmx(ii)),'x',taubmm(ii),tauibmm(ii),'d',[0.001 1.5],[0.001 1.5]);set(gca,'fontsize',13);axis([1e-3 1.5 1e-3 1.5]);xlabel('Bulk Streamwise Stress (N/m^2)');ylabel('Turb Streamwise Stress (N/m^2)');title([jdollars  '  x-mean  o-median  diamond-ID'  ]);
usid=sqrt(tauibmm./rhom);
usc=sqrt(taucxmm./rhom.*gfmu);
usc(1:2)=.92*usid(1:2);
ust=(usc+usid)/2;
taubmm_cor=taubmm;
tauibmm_cor=tauibmm;
dumx_cor=dumx;

 jj=find(  isfinite(taucx) &  isfinite(taub) & (reldir>300 | reldir<60) );
%figure;plot(u10n(jj),taucx(jj),'o',dumx,taubmm,[0 10],[0 0]);set(gca,'fontsize',13);xlabel('U_{10n} (ms^{-1})');ylabel('\tau_x (Nm^{-2})');axis([0 10 -0.05 0.2]);



