function [aa,bb]=makerose(w)
%		sorts and plots rose diagrams of currents.
%
%		Replace v3322 with name of ascii flat file, which
%		should have direction in column 3 and speed in 
%		column 4.  File extension assumed to be .asc.
%
%clg
xbin = [67.5 112.5 157.5 202.5 247.5 292.5 337.5 382.5];
dire = [45.   90.  135.  180.  225.  270.  315.  360. ];
ybin = [10    20    30    40   50   60   70   80  ];
wide = 1.5*[ 0     2     4     6     8    10    12    14  ];
sum  = [ 0     0     0     0     0     0     0     0  ];
%
w=denan(w);
d=90-angled(w);
s=abs(w);
%d=v3322(:,3);
%s=v3322(:,4);
z=s;
i=find(d<22.5);
d(i)=d(i)+360;
[mn,pct]=binsort2(d,s,z,xbin,ybin);
%
%axis('square')
%axis([-40 40 -40 40])
%hold on
%xframe=[-40 40 40 -40 -40];
%yframe=[-40 -40 40 40 -40];
%plot(xframe,yframe,'w-')
for i=1:3
	r=i*10;
	for j=1:101
		theta=j*pi/50;
		x(j)=r*cos(theta);
		y(j)=r*sin(theta);
	end
	%plot(x,y,'g.')
	%text(r*cos(pi/8),r*sin(pi/8),num2str(r))
end
%
%title('PERCENT OF VELOCITY VALUES BY SPEED AND DIRECTION')
%text(-38,35,'R9, 6 mab, winter')
%
k=1;
for i=1:8
	for j=1:8
		if pct(i,j) ~=  0
	 		num = i;
			[a,b]=rosebox(sum(j),dire(j),pct(i,j),wide(i)) ;
			sum(j)=sum(j)+pct(i,j);
			%plot(a,b,'r-')
                        n=length(a);
                        ind=(k:k+n-1);
                        aa(ind)=a;
                        bb(ind)=b;
                        aa(ind(n)+1)=NaN;
                        bb(ind(n)+1)=NaN;
                        k=k+n+1;
                 end 
	end
end
%rosekey(20,-18,ybin,wide,num)
