%
% matlab routine to make bank wide drifter station plot
% for cruise report 
% includes detailed subplots of cluster deployments

    path(path,'/home3/ocn/jmanning/gbs95/atsee')

sb=menu('What?','Summary plot only','summary AND detailed',...
        'just 2a vs 1a','just 1st cluster');

if sb<3;

%%%%%%%%%%%%%%%%     SUMMARY PLOT  %%%%%%%%%%%%%%%%%%%%%

  if sb==2;
    subplot(2,1,1)
    georbat;
    hold on;
  end;

% plot all paths
  dname=['1a';'2a';'4a';'6a';'7a';'4b';'1b';'2b';'4c';'6b';'7b'];
  linet=['- ';'- ';'--';'-.';'. ';'- ';'- ';'--';'-.';'. ';'- '];

% color the tracks
  wcol=menu('What color','multi','black','red');
  if wcol==1;
    coll=['b';'g';'r';'c';'m';'r';'b';'g';'r';'c';'m'];
  elseif wcol==2;
    coll=['w';'w';'w';'w';'w';'w';'w';'w';'w';'w';'w'];
  elseif wcol==3;
    coll=['r';'r';'r';'r';'r';'r';'r';'r';'r';'r';'r'];
  end; 


% loop through each track
  for i=1:length(dname);
%   eval(['load /data1/jgofs/sj9507/drift/p',dname(i,:),'9507e.mat -ascii']);
    eval(['load /data5/jmanning/drift/sj9507/p',dname(i,:),'9507e.mat -ascii']);
    eval(['d=p',dname(i,:),'9507e;']);

% plot the first point
%   plot(d(1,4),d(1,3),'.','markersize',10,...
%        'linewidth',4,'color',coll(i));
    h=plot(d(:,4),d(:,3),...
      'color',coll(i));
%      'linestyle',linet(i),...
%   set(h,'linewidth',1)
    clear d;
  end;

% add mooring sites
  plot([-67.6264 -67.5588],[40.956 40.864],'b.','markersize',22)
  plot([-67.317 -67.542],[40.968 41.407],'b.','markersize',22)
  text(-67.317,41,'moorings')

%axis([-69 -67 40.5 41.5]);
  set(gca,'aspectratio',[1 .78]);
  lllabel(60,60,40,42,-69,-66);
  ylabel('Latitude')

% size the image
  if sb==1;
    set(gca,'position',[.1 .1 .8 .8])
  else;
    set(gca,'position',[.2 .75 .4 .25])
  end;


% continue with detailed image
  if sb==2;

%%%%%%%%%%%%%%%%%   CLUSTERs  %%%%%%%%%%%%%%%%%
    subplot(2,1,2)
    georbat;
    hold on;

%%%%%%%%%%%%%%%%%   FIRST    %%%%%%%%%%%%%%%%%
% plot all paths
    dname=['1a';'2a';'4a';'6a'];
    linet=['- ';'- ';'--';'-.'];
    coll=['b';'g';'r';'c'];
    text(-67.6,41.05,'First Cluster')
    for i=1:length(dname);
      eval(['load /data1/jgofs/sj9507/drift/p',dname(i,:),'9507e.mat -ascii']);
      eval(['d=p',dname(i,:),'9507e;']);

%     plot the track
      h=plot(d(:,4),d(:,3),...
      'color',coll(i));
%      'linestyle',linet(i),...
      set(h,'linewidth',1)

%     plot the first point
      plot(d(1,4),d(1,3),'.','markersize',32,...
        'linewidth',6,'color',coll(i));

%     Now, post the deployment number on top of 1st point
      h1=text(d(1,4),d(1,3),dname(i,:));
      set(h1,'verticalalignment','middle','horizontalalignment','center');
      set(h1,'fontsize',8,'color','k')
      clear d;
    end;

%%%%%%%%%%%%%%%%%    SECOND CLUSTER  %%%%%%%%%%%%%%%%%

%   plot all paths
    dname=['1b';'2b';'4c';'6b';'7b'];
    linet=['- ';'- ';'--';'-.';'. '];
    coll=['b';'g';'r';'c';'m'];
    text(-68.15,40.95,'Second Cluster')
    fm=text(-68.2,41.1,'* = fixed mooring sites');
    set(fm,'fontsize',8);
    for i=1:length(dname);
      eval(['load /data1/jgofs/sj9507/drift/p',dname(i,:),'9507e.mat -ascii']);
      eval(['d=p',dname(i,:),'9507e;']);

%     plot the track
      h=plot(d(:,4),d(:,3),...
      'color',coll(i));
%      'linestyle',linet(i),...
      set(h,'linewidth',1)

%     plot the first point
      plot(d(1,4),d(1,3),'.','markersize',32,...
        'linewidth',6,'color',coll(i));

%     Now, post the deployment number on top of 1st point
      h1=text(d(1,4),d(1,3),dname(i,:));
      set(h1,'verticalalignment','middle','horizontalalignment','center');
      set(h1,'fontsize',8,'color','k')
      clear d;
    end;


% add mooring sites
    plot([-67.6264 -67.5588],[40.956 40.864],'r*')
    plot([-67.317 -67.542],[40.968 41.407],'r*')

    set(gca,'aspectratio',[1 .78]);
    set(gca,'position',[.1 .2 .85 .5])
    axis([-68.4 -67.3 40.55 41.1]);
    lllabel(20,20,40.333,41,-68.5,-67.333);

    set(gcf,'paperposition',[.5 1 8 9.5])
  end;

end;

%%%%%%%%%%%%%%%%%%%%%%% 2a va 1a Comparison
% 

if sb==3;

%  georbat;
  hold on;

% plot all paths
  dname=['1a';'2a'];
  linet=['- ';'--'];

% color the tracks
  wcol=menu('What color','multi','black','red');
  if wcol==1;
    coll=['g';'r'];
  elseif wcol==2;
    coll=['w';'w'];
  elseif wcol==3;
    coll=['r';'r'];
  end; 


% loop through each track
  for i=1:length(dname);
    eval(['load /data4/jmanning/drift/sj9507/p',dname(i,:),'9507e.mat -ascii']);
    eval(['d=p',dname(i,:),'9507e;']);

%   plot the first point
%   plot(d(1,4),d(1,3),'.','markersize',10,...
%        'linewidth',4,'color',coll(i));
    h=plot(d(:,4),d(:,3),...
      'color',coll(i));
%      'linestyle',linet(i),...
   set(h,'linewidth',1)
   if i~=length(dname);
    clear d;
   end;
  end;

% add mooring sites
   disp('Harcoded to NOT plot mooring sites')
%  plot([-67.6264 -67.5588],[40.956 40.864],'r.','markersize',20)
%  plot([-67.317 -67.542],[40.968 41.407],'r.','markersize',20)
%  text(-67.5,41,'moorings (*)','color','c')

% lllabel(60,60,40,42,-69,-66);
% ylabel('Latitude')

% size the image
  if sb~=1;
    set(gca,'position',[.1 .1 .8 .8])
  else;
%  set(gca,'position',[.2 .75 .4 .25])
  end;

elseif sb==4;

%%%%%%%%%%%%%%%%%   FIRST CLUSTER   %%%%%%%%%%%%%%%%%
  georbat;

%  plot all paths
  dname=['1a';'2a';'4a';'6a'];
  linet=['- ';'- ';'--';'-.'];
  coll=['b';'g';'r';'c'];
  text(-67.6,41.05,'First Cluster')
  for i=1:length(dname);

%   load data 
    eval(['load /data5/jmanning/drift/sj9507/p',dname(i,:),'9507e.mat -ascii']);
    eval(['d=p',dname(i,:),'9507e;']);

%   plot the track
    h=plot(d(:,4),d(:,3),...
      'color',coll(i));
%      'linestyle',linet(i),...
    set(h,'linewidth',1)
    hold on;

%   plot the first point
    plot(d(1,4),d(1,3),'.','markersize',32,...
        'linewidth',6,'color',coll(i));

% Now, post the deployment number on top of 1st point
      h1=text(d(1,4),d(1,3),dname(i,:));
      set(h1,'verticalalignment','middle','horizontalalignment','center');
      set(h1,'fontsize',8,'color','k')
    clear d;
  end;
 
% fix axis
  axis([-68 -67.25 40.5 41.25]);
  lllabel(30,30,40,42,-68,-67);
end;