% rod_track
clear all
addpath /home/valery/b2disk/oa_hershel
addpath /home/valery/bin
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);
n1=4070;n2=length(ABS_U);%n2=313
%u(489:496)=nan;v(489:496)=nan;
uf(1121:1128)=[];vf(1121:1128)=[];
u(1121:1128)=[];v(1121:1128)=[];
time(1121:1128)=[];nav(:,1121:1128)=[];
n2=n2-8;
% warm eddy A1
%[xx,yy]=meshgrid(-63.8:.05:-62.6,32.4:.05:33.7);
% meshgrid C2
%[xx,yy]=meshgrid(-60.5:.05:-59.0,31.0:.05:31.6);
%mesgrid c1
[xx,yy]=meshgrid(-61.2:.05:-59.2,30.0:.05:31.0);
uu=griddata(nav(1,n1:n2),nav(2,n1:n2),u(n1:n2),xx,yy);
vv=griddata(nav(1,n1:n2),nav(2,n1:n2),v(n1:n2),xx,yy);
load /data/cruises/oc404_4/c1c2grid
h1=plot(nav(1,n1:n2),nav(2,n1:n2),'b-')
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(:);

hold on
h2=vecplot2(xx(:),yy(:),uu(:),vv(:),0.4,'cm/sec')
set(h2,'color',[.0 .5 .5])
pp=axis
axis([pp]);
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
setaxis
xlabel('Longitude')
ylabel('Latitude')
title('Cold Eddy C2: interpolated adcp velocity')
load /home/valery/ucbuoy2.txt
cc=ucbuoy2;
hold on
plot(cc(:,4),cc(:,3),'.g-','linewidth',2.5)
hold off
gtext([datestr(now,0)])
%hold on
%stream2(xx,yy,uu,vv,cc(1,1),cc(1,2))

%fig2jpeg('adcp_int_0728.jpg')
%print adcp_int_0728.ps -dpsc
%!lp adcp_int_0728.ps 

