%load rocky
!rm rose.met
[m,n]=size(w);
nind=length(ind);
%bins
dx=.5;
xb=[-15.5:dx:15.5];
yb=xb;
%
is=[1 3 6 12 14 16 19 21 24];   %surface 0 -10
im=[2 4 7 13 15 17 20 22 25];   % mid 10-30
inb=[5 8 9 23];                 % near bot 
ib=[10 11 ];
%
%  get coastline and 40 m isobath
load coast
load bath40
%  set up plot
lat_mid=42.3;
lat_max=42.6;
lon_mid=-70.4;
dlon=1.4;
lat_fac=cos(lat_mid*pi/180);
dlat=dlon*lat_fac;
% factor for roses
%
yfac=1./111;   % 111 kmlength particles would travel in one day :
xfac=yfac/lat_fac;

%for k=4:6,    % fall 90- spring 91
for k=1:1,
hold off
axis('square')
axis([lon_mid-.5*dlon lon_mid+.5*dlon lat_mid-.5*dlat lat_mid+.5*dlat]);
in=1:length(coast(:,1));
plot(coast(in,1),coast(in,2));
hold on
mplot(bath40,'.')
hold on
for i=is,
%  i1=ind(k);
%  i2=ind(k+1);
   i1=1;
   i2=length(w(:,1));
%
   ii=i1:i2;
  str1=date_lbl(gregorian(jd(i1)),gregorian(jd(i2)));
  z=denan(w(ii,i));
  if(length(z)>6*60),
    [z]=shot(z,1,1/24);
    [a,hits,xc,yc]=binsort(real(z),imag(z),real(z),xb,yb);
    hits=hits/(dx*dx);
    hits=smooth2d(hits);
    hits=smooth2d(hits);
    c=contour(hits,[.10 .30 .50 .70 .90],xc,yc);
    cdf_groups(i,:);
    nl=int2str(length(z));
    [mc,nc]=size(c);
    k1=1;
    while (k1<nc),
      lev=c(1,k1);
      len=c(2,k1);
      k2=k1+len;
      c(:,k1)=c(:,k1)*NaN; 
      k1=k2+1;
    end
    c(1,:)=c(1,:)*xfac+lonlat(i,1);
    c(2,:)=c(2,:)*yfac+lonlat(i,2);
    plot(lonlat(i,1),lonlat(i,2),'wo')
    mplot(c','g-');
  end
end
title(str1);
hold off
pause
end
