% rod_track
addpath /home/valery/bin
addpath /home/valery/b2disk/opnml/FEM
addpath /home/valery/b2disk/opnml/basics

set(gcf,'color','w');
load adcp4quoddy

for i=[1:length(ABS_U)]
u(i)=nanmean(ABS_U(:,i));
v(i)=nanmean(ABS_V(:,i));
end
hh=fspecial('average',[1,13]);
uf=filter2(hh,u);vf=filter2(hh,v);
% exclude "bad" points
%u(489:496)=nan;v(489:496)=nan;
nav(:,1121:1130)=nan;time(1121:1130)=nan;
u(1121:1130)=nan;v(1121:1130)=nan;
n1=4070;n2=length(ABS_U);%n2=3900
n3=4420;n4=4070;

h1=plot(nav(1,n4:n2),nav(2,n4:n2),'c-','linewidth',2);
hold on

h1=vecplot2(nav(1,n1:n3),nav(2,n1:n3),u(n1:n3),v(n1:n3),0.4,'cm/sec')
set(h1,'color',[0.85 .85 .85])
h2=vecplot2(nav(1,n3+1:n2),nav(2,n3+1:n2),u(n3+1:n2),v(n3+1:n2),0.4,'cm/sec')
set(h2,'color',[0.0 .5 .5])
%h3=vecplot2(nav(1,n4:n1-1),nav(2,n4:n1-1),u(n4:n1-1),v(n4:n1-1),0.4,'cm/sec')
%set(h3,'color',[0.85 .85 .85])

plot(nav(1,n2),nav(2,n2),'d','markersize',10,'markerfacecolor','c',...
'markeredgecolor','r');
%load /home/valery/ucbuoy2.txt
%cc=ucbuoy2;
%plot(cc(:,4),cc(:,3),'.g-','linewidth',2.5)
%load /data/cruises/oc404_4/rotang
load /data/cruises/oc404_4/c1c2grid
x1=xi(1:34,1:25);y1=yi(1:34,1:25);
x1=x1';y1=y1';
x1=x1(:);y1=y1(:);
x2=xi(1:34,26:50);y2=yi(1:34,26:50);
x2=x2';y2=y2';
x2=x2(:);y2=y2(:);

pp=axis
%axis([pp]);
% plot the only numbers inside axis
ff=find(x1>pp(1) & x1<pp(2) & y1>pp(3) & y1<pp(4));
for i=[1:length(ff)]         
   text(x1(ff(i)),y1(ff(i))',['  ',num2str(ff(i))],'fontsize',7)
   end
plot(x1(ff),y1(ff),'sm','markersize',4)
   
ff=find(x2>pp(1) & x2<pp(2) & y2>pp(3) & y2<pp(4));
   for i=[1:length(ff)]         
   text(x2(ff(i)),y2(ff(i))',['  ',num2str(ff(i)+850)],'fontsize',7)
   end
plot(x2(ff),y2(ff),'sm','markersize',4)
hold off
  
grid
xlabel('Longitude')
ylabel('Latitude')
title('Cold Eddy C2: adcp velocity')
%gtext([datestr(now,0)])
