%Plot Abaco cruise track
clf;

for i=1:length(cnv_fill)
LAT(1:length(cnv_fill(i).latitude),i)=cnv_fill(i).latitude(1:length(cnv_fill(i).latitude));
LON(1:length(cnv_fill(i).longitude),i)=cnv_fill(i).longitude(1:length(cnv_fill(i).longitude));
STT(1:length(cnv_fill(i).station),i)=cnv_fill(i).station(1:length(cnv_fill(i).station));
end;

%eliminate test cast
LAT=LAT(2:end);
LON=LON(2:end);
STT=STT(2:end);

xmn=min(LON)-1+360;
xmx=max(LON)+1+360;%matlab doesn't like this, but just close out the error msg and it works
ymn=min(LAT)-1;
%ymx=max(LAT)+1;
ymx=32.776+1;


%Set color scheme
colormap('winter');


%grid_sand reads in land bathymetry
[ZI,YI,XI]=grid_sand([ymn ymx xmn xmx]);


%%%%% initialize the map
m_proj('mercator','longitudes',[xmn,xmx],'latitudes',[ymn,ymx]);

%load land
m_gshhs_h('patch',[.5 .5 .5]);
hold on;
%m_coast('patch',[.7 .7 .7],'edgecolor','none');

% plot contoured bathymetry here
[c,h]=m_contourf(XI,YI,ZI,[-6000:1000:0]);
hold on;
%[c,h]=m_contourf(XI,YI,-ZI,[0:1000:6000]);
%Invert the colorbar color scheme 
% map=colormap;
% map=flipud(map);
% colormap(map);
%reverse numbering w/ deeper depths darker blue
%revyaxis;

%scale the axis
font(14);
%axis equal;
%axis tight;
colorbar;
lg=xlabel('Longitude ','fonts',16);
lt=ylabel('Latitude ','fonts',16,'position',[-0.85 -0.518187 1.00007e+16]);
%plot text for contour label
h=text(0.9,-0.55,'Depth ','rotation',90,'fonts',16);

% Plot cruise Abrico track
  %plot transit from Charleston   
  htob=m_plot([-79.931 LON(1)]+360,[32.776 LAT(1)],'--k','linewidth',1.8);
  hold on;  

  %abaco line  
  htab=m_plot(LON(1:33)+360,LAT(1:33),'k');
  set(htab,'linewidth',2)
  hsab=m_plot(LON(1:33)+360,LAT(1:33),'or');
  set(hsab,'markersize',6,'markerfacecolor',[1 0 0]);
  ho=m_plot(LON(1:33)+360,LAT(1:33),'or','linewidth',1.5);
  hold on;
  
  %northwest providence channel
  htpc=m_plot(LON(34:38)+360,LAT(34:38),'k');
  set(htpc,'linewidth',2)
  hspc=m_plot(LON(34:38)+360,LAT(34:38),'or');
  set(hspc,'markersize',6,'markerfacecolor',[1 0 0]);
  ho=m_plot(LON(43:38)+360,LAT(43:38),'or','linewidth',1.5);
  hold on;
  
  %26 N 
  htsn=m_plot(LON(39:49)+360,LAT(39:49),'k');
  set(htsn,'linewidth',2)
  hssn=m_plot(LON(39:49)+360,LAT(39:49),'or');
  set(hssn,'markersize',6,'markerfacecolor',[1 0 0]);
  ho=m_plot(LON(39:49)+360,LAT(39:49),'or','linewidth',1.5);
  hold on;
  
  %27 N
  htsn=m_plot(LON(50:58)+360,LAT(50:58),'k');
  set(htsn,'linewidth',2)
  hssn=m_plot(LON(50:58)+360,LAT(50:58),'or');
  set(hssn,'markersize',6,'markerfacecolor',[1 0 0]);
  ho=m_plot(LON(50:58)+360,LAT(50:58),'or','linewidth',1.5);
  hold on;
  
  %plot return transit from Charleston   
  btor=m_plot([LON(58) -79.931]+360,[LAT(58) 32.776],'--k','linewidth',1.8);
  hold on;
  hor=m_plot(-79.931+360,32.776,'or');
  set(hor,'markersize',6','markerfacecolor',[1 0 0]);
  hold on;

%Convert lat/lon to cartesian coordinates 
[xsc,ysc]=m_ll2xy(LON+360,LAT);

for ii=1:length(cnv_fill)-1
if ~mod(ii,5)
    tt=text(xsc(ii)-0.0009,ysc(ii)+0.005,int2str(STT(ii)));%xsc(ii)-0.005,ysc(ii)+0.013
    set(tt,'fontsize',14,'color',[1 1 1])
    ha=m_plot(LON(ii)+360,LAT(ii)+0.13,'vw');
    set(ha,'markersize',4,'markerfacecolor',[0 0 0])
end;
end;
%cbar=text(.125,.475,'Depth','rotation',90,'fonts',16);
cbar=text(.13,.53,'Depth','rotation',90,'fonts',16);

%lt=ylabel('Latitude ','fonts',16,'position',[-0.12 0.48]);
lt=ylabel('Latitude ','fonts',16,'position',[-0.12 0.54]);
xlabel('Longitude','fonts',16)
title('February 2012 Abico Cruise Track','fonts',16)
%return
m_grid('box','fancy');

%fill in contour lines with color
set(findobj('tag','m_grid_color'),'facecolor','none')

%print -dpng abaco1202_cruisetrack.png
set(gcf, 'PaperPositionMode', 'auto');
print('-depsc2','abaco1202_cruisetrack.eps'); 