% Load the positions of the Casts
load Z:\oc415_2\adcp\positions\station.dat
sta_lat = station(1:7,3);
sta_lon = station(1:7,4);

% Load all data for E-W CTD section (stations 1-7)
for ii=1:7
    eval(['load Z:\oc415_2\ctd\process\oc41520', num2str(ii),'.mat'])
    for jj=1:700
        index = find( press>(jj-1) & press<=jj );
        t0_mat1(jj,ii) = mean(t0(index));
        t1_mat1(jj,ii) = mean(t1(index));
        c0_mat1(jj,ii) = mean(c0(index));
        c1_mat1(jj,ii) = mean(c1(index));
        chl_mat1(jj,ii)=mean(chl(index));
        o2_mat1(jj,ii) = mean(o2(index));
        pres_mat1(jj,ii) = mean(press(index));
        par_mat1(jj,ii)=mean(par(index));
        s0_mat1(jj,ii) = mean(s0(index));
        s1_mat1(jj,ii) = mean(s1(index));
    end
end

% Make a depth vector of all the plots (y-axis)
depth = [1:700];

% Make a contour plot of the loaded temp data
h411 = subplot(411);
[C,h411p]=contourf(sta_lon,depth,t0_mat1,[18.8:0.5:30],'LineStyle','none');
axis([-67.2467 -66.6145 0 200])
set(gca,'ydir', 'rev')
set(h411,'fontsize',12)
set(h411,'ytick', [50 100 150 200])
pos1 = get(h411,'Position');
pos1(3:4) = [0.77 0.175];
set(h411, 'Position', pos1)
set(h411, 'xtick', [])
h411t = title({'OC415-2, EW CTD Survey, 20Jul2005';'Temperature (C)'});
pos1t = get(h411t,'Position');
pos1t(2) = -20;
set(h411t,'Position', pos1t)
h411c = colorbar;
set(h411c, 'fontsize', 7)
%ylabel('Pressure Depth (db)')
%xlabel('Longitude')
% Add the locations of the profiles
surface=ones(1,7);
sta_num=[1:7];
hold on
plot(sta_lon,surface,'dk', 'MarkerFaceColor','k', 'MarkerSize', 5)
text(sta_lon,(surface*(-13)),int2str(sta_num'),'fontsize',5);
hold off

% Add a salinity plot
h412 = subplot(412);
[C,h412p]=contourf(sta_lon,depth,s0_mat1,[35.9:0.1:37.1],'LineStyle','none');
axis([-67.2467 -66.6145 0 200])
set(gca,'ydir', 'rev')
set(h412,'fontsize',12)
set(h412,'ytick', [50 100 150 200])
pos2 = get(h412,'Position');
pos2(3:4) = [0.77 0.175];
set(h412, 'Position', pos2)
set(h412, 'xtick', [])
h412t = title('Salinity');
pos2t = get(h412t,'Position');
pos2t(2) = -20;
set(h412t,'Position', pos2t)
h412c = colorbar;
set(h412c, 'fontsize', 7)
%ylabel('Pressure Depth (db)')
%xlabel('Longitude')
% Add the locations of the profiles
surface=ones(1,7);
sta_num=[1:7];
hold on
plot(sta_lon,surface,'dk', 'MarkerFaceColor','k', 'MarkerSize', 5)
text(sta_lon,(surface*(-13)),int2str(sta_num'),'fontsize',5);
hold off

% Add an oxygen saturation plot
h413 = subplot(413);
[C,h413p]=contourf(sta_lon,depth,o2_mat1,[6:0.05:7.5],'LineStyle','none');
axis([-67.2467 -66.6145 0 200])
set(h413,'fontsize',12)
set(h413,'ytick', [50 100 150 200])
set(gca,'ydir', 'rev')
pos3 = get(h413,'Position');
pos3(3:4) = [0.77 0.175];
set(h413, 'Position', pos3)
set(h413, 'xtick', [])
h413t = title('Oxygen Saturation (%)');
pos3t = get(h413t,'Position');
pos3t(2) = -20;
set(h413t,'Position', pos3t)
h413c = colorbar;
set(h413c, 'fontsize', 7)
hY = ylabel('                                 Pressure Depth (db)');
set(hY, 'FontWeight', 'bold');
%xlabel('Longitude')
% Add the locations of the profiles
surface=ones(1,7);
sta_num=[1:7];
hold on
plot(sta_lon,surface,'dk', 'MarkerFaceColor','k', 'MarkerSize', 5)
text(sta_lon,(surface*(-13)),int2str(sta_num'),'fontsize',5);
hold off

% Add an Chlorophyll Fluorescence plot
h414 = subplot(414);
[C,h414p] = contourf(sta_lon,depth,chl_mat1,[0:0.1:2],'LineStyle','none');
axis([-67.2467 -66.6145 0 200])
set(gca,'ydir', 'rev')
set(h414,'fontsize',12)
set(h414,'ytick', [50 100 150 200])
pos4 = get(h414,'Position');
pos4(3:4) = [0.77 0.175];
set(h414, 'Position', pos4)
h414t = title('Chlorophyll Fluorescence (ug/m^3)');
pos4t = get(h414t,'Position');
pos4t(2) = -20;
set(h414t,'Position', pos4t)
h414c = colorbar;
set(h414c, 'fontsize', 7)
%ylabel('Pressure Depth (db)')
hX = xlabel('Longitude');
set(hX, 'FontWeight', 'bold')
% Add the locations of the profiles
surface=ones(1,7);
sta_num=[1:7];
hold on
plot(sta_lon,surface,'dk', 'MarkerFaceColor','k', 'MarkerSize', 5)
text(sta_lon,(surface*(-13)),int2str(sta_num'),'fontsize',5);
hold off

