function [A,hits]=dobin2(wind,x,jd,is) 
%function [A,hits]=dobin2(w,x,jd,is) 
% DOBIN3
% DO a BINsort of a scalar on the east and north wind
% components.
% 
%

% sample run
% load rocky
% dobin2(logan_wind_str,wlp(:,18),jdlp,ind)
% does binsort for each season at cdf_group 18 (u6_72)
%
xbins=[-5:1:5];
ybins=[-5:1:5];
axlim=[-5 5 -5 5];
%
n=length(is);
for ii=1:n-1;
  k=is(ii):is(ii+1);
  ind=find([wind(k)+x(k)]~=NaN);
  if(length(ind)>20),
    wu=real(wind(k(ind)));
    wv=imag(wind(k(ind)));
    [A,hits,xc,yc]=binsort(wu,wv,x,xbins,ybins);
%
% PLOTTING STUFF
%
  hold off
  axis('square')
  axis(axlim)
  [xx,yy]=meshdom(xc,yc);
  B=replace(A,NaN,0.);
  c=contour(B,xc,yc);
  clabel(c);
  grid
  xlabel('u wind (dyn/cm2)')
  ylabel('v wind (dyn/cm2)')
  start_time=gregorian(jd(is(ii)));
  stop_time=gregorian(jd(is(ii+1)));
  text(0.70,0.21,date_lbl(start_time,stop_time),'sc');
%text(0.70,0.17,depth_lbl(cdf2,'east'),'sc');
  if (exist('bin.met')~=2),
   meta bin
  else
   meta
  end
  pause
  showvar(xx(:),yy(:),A*100)
  grid
  xlabel('u wind (dyn/cm2)')
  ylabel('v wind (dyn/cm2)')
  title('Average value in bin');
  pause;
  hold off
  showvar(xx(:),yy(:),hits(:)*sum(hits(:)))
  grid
  xlabel('u wind (dyn/cm2)')
  ylabel('v wind (dyn/cm2)')
  title('Hits per bin ');
  pause
  hold off
  if (exist('hit.met')~=2),
    meta hit
  else
    meta
  end
end
end
