%locsCTD
%
%Program to create a plot of the locations of the CTD casts from the
%Endeavor and Oceanus cruises
%
%Soupy Alexander, 3/26/02

%Pull in the data
load C:\NewYork\NewYorkCD\Data_Files\Tri_Moor_Data\matlab\movieData.mat

for index = 1:2;
    figure(index)
hold on

%Set up the mercator projection with M_Map
%Problem with the coastline data?
m_proj('mercator','longitudes',[-74.4 -73],'latitudes',[39.8 40.8]);
m_grid('tickdir','out','box','on','gridtoggle','off');
m_usercoast('NewYorkCoast','patch',...
    [(0/255) (190/255) (0/255)],'edgecolor','k');

%Put in the bathymetry
[c,h]=m_contour(xbathyg, ybathyg, -1*zbathygo,[10:10:100],'k');
c_lbl =[
  -74.0700   39.8599    10
  -73.6300   40.5780    10
  -73.9568   39.8699    20
  -73.5661   40.4900    20
  -73.7374   39.9360    30
  -73.4177   40.3402    30
  -73.4532   39.8980    40
  -73.3300   40.1499    40
  -73.1100   39.9869    50
];
htxt=m_text(c_lbl(:,1), c_lbl(:,2), num2str(c_lbl(:,3)));
for ii=1:length(htxt)
  set(htxt(ii),'erasemode','normal');
  set(htxt(ii),'color',[0.4 0.4 0.4])
   set(htxt(ii),'fontweight','bold');
end
set(h,'color',[0.4 0.4 0.4])

%%Put in a legend
%Stations
m_plot(-74.36,39.85,'k^','Markersize',8,'MarkerFaceColor','b');
m_text(-74.32,39.85,'Tripod','horizontalalignment','left','fontsize',10)
%Buoys
m_plot(-74.36,39.90,'ko','Markersize',8,'MarkerFaceColor','r');
m_text(-74.32,39.90,'Buoy','horizontalalignment','left','fontsize',10)

%Put in the buoys and stations
dl=0.02;
label=['A';'B';'C';'D';'E';'F'];
m_plot(stat_lon,stat_lat,'k^','markersize',8,'markerfacecolor','b');
for si = 1:6;
    m_text(stat_lon(si)+dl,stat_lat(si)+dl,label(si),...
        'fontweight','bold','fontsize',10);
end

end

%Put in the Endeavor cast locations

figure(1)
%Put in the title of the plot
title('Endeavor Cast Locations', ...
    'fontweight','bold','fontsize',14);

load C:\NewYork\NewYorkCD\Data_Files\CTD_Data\Mat_Files\en_ctd_mat.mat

for index = 1:10;   
    cast = evalin('base',['ctd' num2str(index,'%02d') 'b']);
    lat = nanmean(cast(:,4));
    lon = nanmean(cast(:,5));
    cast_hit = m_plot(lon,lat,'ko');
    set(cast_hit,'Markersize',6);
    set(cast_hit,'MarkerFaceColor','r');
    m_text(lon+dl,lat+dl,num2str(index),'fontweight','bold','fontsize',8);
end    

%Put in the Oceanus cast locations

figure(2)
load C:\NewYork\NewYorkCD\Data_Files\CTD_Data\Mat_Files\oc_ctd_mat.mat

%Put in the title of the plot
title('Oceanus Cast Locations', ...
    'fontweight','bold','fontsize',14);

for index = 1:39;  
    cast = evalin('base',['ctd' num2str(index,'%02d') 'b']);
    lat = nanmean(cast(:,5));
    lon = nanmean(cast(:,6));
    cast_hit = m_plot(lon,lat,'ko');
    set(cast_hit,'Markersize',6);
    set(cast_hit,'MarkerFaceColor','r');
    m_text(lon+dl,lat+dl,num2str(index),'fontweight','bold',...
        'fontsize',8);
end    


