function [A,B,hits]=dobinrot(cdf1,us1,vs1,cdf2,us2,vs2);
% DO a BINsort of current meter velocity on the east and north wind
% components, but on a polar plot!.
%
ntbins=12;
%
tbin1=-(pi+pi/ntbins);
tbins=[tbin1:(2*pi/ntbins):(tbin1+2*pi)];
rbins=[0:.5:4];
axis([-4 4 -4 4]);
%
% get start and stop times of overlapping record
%
[start_time,stop_time]=overlap(cdf1,cdf2);
[icyc,ncyc]=mctime(cdf1,start_time,stop_time);
u1=mcvgt(cdf1,us1,icyc,ncyc);
v1=mcvgt(cdf1,vs1,icyc,ncyc);
u1=plfilt(u1);
v1=plfilt(v1);
w1=u1+i*v1;
theta1=angle(w1);
rho1=abs(w1);
%
[icyc,ncyc]=mctime(cdf2,start_time,stop_time);
u2=mcvgt(cdf2,us2,icyc,ncyc);
v2=mcvgt(cdf2,vs2,icyc,ncyc);
u2=plfilt(u2);
v2=plfilt(v2);
%
[A,B,hits,theta_c,rho_c]=binpol(theta1,rho1,u2,v2,tbins,rbins);
%
% PLOTTING STUFF
%
hold off
[tt,rr]=meshdom(theta_c,rho_c);
 arrowpol(tt(:),rr(:),A(:),B(:),.4,'g-','polar')
  grid
 xlabel('u wind (m/s)')
 ylabel('v wind (m/s)')
 title('Water velocity sorted on wind');
 text(0.70,0.25,file_lbl(cdf2),'sc');
 text(0.70,0.21,date_lbl(start_time,stop_time),'sc');
 text(0.70,0.17,depth_lbl(cdf2,'east'),'sc');
%if(exist('bins.met')~=2),
%  meta bins
%else
%  meta
%end
 pause
 showpol(tt(:),rr(:),hits(:))
 grid
 xlabel('u wind (m/s)')
 ylabel('v wind (m/s)')
 title(['Hits per bin ' cdf2(1:4)])
%if(exist('hits.met')~=2),
%  meta hits
%else
%  meta
%end
 
