% plot_adcp.m
% =====================================================
% plot velocity vectors using adcp data
% =====================================================
% if plot station positions (=1)
         pgrd=1
% if plot adcp vectors  
         hi=0
% load adcp data + navigation from .mat file
         load imotion_init
% set limits for plotting: n1=1 if whole track
         n1=1400;n2=length(nav);%n2=1000
% plot navigation (ship track)
         set(gcf,'color','w');
         h1=plot(nav(1,n1:n2),nav(2,n1:n2),'k-','linewidth',1);
         hold on
% plot vectors -- until n3, in grey, then from n3 to n2
     if(hi==1)
         h2=vecplot2(nav(1,n1:n2),nav(2,n1:n2),u(n1:n2),v(n1:n2),0.3,'cm/sec')
         set(h2,'color','b')
     end
% extend axis         
         pp=axis;
         axis([pp(1)-.1 pp(2)+.1 pp(3)-.1 pp(4)+.1]);
         grid
         hold off
         axis equal
         title(['time (GMT): ',starttime,' -- ',endtime]);
% plot station positions
        if(pgrd==1)
        load /data/cruises/oc415_1/coord_mtx_05new.txt;
        c=coord_mtx_05new;
        pp=axis
% plot the only numbers inside axis
        ff=find(c(:,3)>pp(1) & c(:,3)<pp(2) & c(:,2)>pp(3) & c(:,2)<pp(4));
      for i=[1:length(ff)]         
        text(c(ff(i),3),c(ff(i),2),['   ',num2str(c(ff(i),1))],'fontsize',7);
      end
      hold on
        plot(c(ff,3),c(ff,2),'sm','markersize',7)  
      end 
        hold off
        xlabel('Longitude')
        ylabel('Latitude')
        gtext([datestr(now,0)])
