% Program that plots sections for various parameters
%Shallow Section
clear prof
load ab0409_db.mat
cnv(15).data(321,3:20)=cnv(15).data(322,3:20);
pressure=1:800';
%load ctd.txt
%lon=-ctd(:,2);
%lat=ctd(:,1);
l=1;
for i=15:19
    lon(i)=cnv(i).lon;
   max_depth=find(cnv(i).data(:,2)==max(cnv(i).data(:,2)));
   prof_prov(i)=max_depth-20;
   for j=1:max_depth
   lon_prov(l)=lon(i);    
   pressure_prov(l)=cnv(i).data(j,2);
   pot_temp_prov(l)=cnv(i).data(j,15);
   sal_prov(l)=cnv(i).data(j,18);
   oxygen_prov(l)=cnv(i).data(j,11);
   sigma0_prov(l)=cnv(i).data(j,9);
   %sigma2_prov(l)=out(i).data(j,7);
   %sigma4_prov(l)=out(i).data(j,7);
   l=l+1;
   end
end
lon_i=lon(15)+0.01:-0.02:lon(19)-0.03;
pot_temp_i=griddata(lon_prov,pressure_prov,pot_temp_prov,lon_i',pressure);
pot_temp_i(:,37)=pot_temp_i(:,36);
pot_temp_i(:,1)=pot_temp_i(:,2);
c_color=[2:2:40];
contourf(lon_i,pressure,pot_temp_i,c_color)
colormap(cejet)
colorbar
hold on
%Ploting the potential temperature
%makefig
%makeaxis(1,1,6,8.7)
c1=[5:9 11:14 16:19 21:35];
[C,h]=contour(lon_i,pressure,pot_temp_i,c1,'k');
axis([-80.07 -79.19 0 800])
ax1=gca;
set(ax1,'FontSize',14,'ydir','reverse','XAxisLocation','top','Xtick',[ 26.1 26.2 26.3 26.4],'XtickLabel',[]);
hold on
for t=15:length(prof_prov)
    plot([lon(t) lon(t)],[0 prof_prov(t)],'k--')
end
xlabel('Florida South Section')
ax2=gca;
set(ax2,'XAxisLocation','bottom');set(0,'DefaultTextFontSize',14);
set(0,'DefaultTextFontSize',14);
set(0,'DefaultTextFontSize',14);
text(-80.03,-40,'80.0^oW');
text(-79.83,-40,'79.8^oW');
text(-79.63,-40,'79.6^oW');
text(-79.43,-40,'79.4^oW');
text(-79.23,-40,'79.2^oW');
%text(-71.15,-40,'71^oW');
%text(-70.15,-40,'70^oW');
[C,h]=contour(lon_i,pressure,pot_temp_i,[10 15 20],'k');
h1=clabel(C,h);
ax1=gca;
set(ax1,'FontSize',14,'ydir','reverse','Xtick',[ 26.1 26.2 26.3 26.4],'XtickLabel',[]);
set(h,'LineWidth',2);
%xlabel('Longitude');
patch([lon(15:19)  -80.065 -80.065 -79.195 -79.195],[prof_prov(15:19) 153 800 800 155],'w','LineWidth',3);
text(-80.02,600,'Potential Temperature [^{o}C]')
noaalogo([0.13 0.13 0.15 0.15])
%break

%Ploting the salinity
figure
sal_i=griddata(lon_prov,pressure_prov,sal_prov,lon_i',pressure);
sal_i(:,37)=sal_i(:,36);
sal_i(:,1)=sal_i(:,2);
csal1=[34:0.01:34.9];
csal2=[35.05:0.05:35.1];
csal3=[35.1:0.1:35.4 35.6:0.1:35.9 36.1:0.1:36.4 36.6:0.1:38];

c_color=[34:0.01:34.9 35.05:0.05:35.1 35.1:0.1:35.4 35.6:0.1:35.9 36.1:0.1:36.4 36.6:0.1:38 ];
contourf(lon_i,pressure,sal_i,c_color)
colormap(cejet)
colorbar
hold on

[C,h]=contour(lon_i,pressure,sal_i,csal1,'k');
axis([-80.07 -79.19 0 800])
ax1=gca;
set(ax1,'FontSize',14,'ydir','reverse','XAxisLocation','top','Xtick',[ 26.1 26.2 26.3 26.4],'XtickLabel',[]);
hold on
for t=15:length(prof_prov)
    plot([lon(t) lon(t)],[0 prof_prov(t)],'k--')
end
xlabel('Florida South Section')
ax2=gca;
set(ax2,'XAxisLocation','bottom');set(0,'DefaultTextFontSize',14);
text(-80.03,-40,'80.0^oW');
text(-79.83,-40,'79.8^oW');
text(-79.63,-40,'79.6^oW');
text(-79.43,-40,'79.4^oW');
text(-79.23,-40,'79.2^oW');
%text(26.0,-20,'26.0^oW');
%text(-71.15,-40,'71^oW');
%text(-70.15,-40,'70^oW');
[C,h]=contour(lon_i,pressure,sal_i,csal2,'k');
[C,h]=contour(lon_i,pressure,sal_i,csal3,'k');
[C,h]=contour(lon_i,pressure,sal_i,[35 35.5 36 36.5],'k');
h1=clabel(C,h);
ax1=gca;
set(ax1,'FontSize',14,'ydir','reverse','Xtick',[ 26.1 26.2 26.3 26.4],'XtickLabel',[]);
set(h,'LineWidth',2);
ylabel('Pressure (dbar)');
patch([lon(15:19)  -80.065 -80.065 -79.195 -79.195],[prof_prov(15:19) 153 800 800 155],'w','LineWidth',3);
text(-80.02,600,'Salinity [psu]')
noaalogo([0.13 0.13 0.15 0.15])
%Ploting the potential density
figure
sigma0_i=griddata(lon_prov,pressure_prov,sigma0_prov,lon_i',pressure);
sigma0_i(:,37)=sigma0_i(:,36);
sigma0_i(:,1)=sigma0_i(:,2);
cpd1=22:0.5:25.9;
cpd2=26.1:0.2:26.4;
cpd3=[26.5:0.1:26.9 27.1:0.1:27.4];

c_color=[22:0.5:25.9 26.1:0.2:26.4 26.5:0.1:26.9 27.1:0.1:27.4];
contourf(lon_i,pressure,sigma0_i,c_color)
colormap(cejet)
colorbar
hold on

[C,h]=contour(lon_i,pressure,sigma0_i,cpd1,'k');
axis([-80.07 -79.19 0 800])
ax1=gca;
set(ax1,'FontSize',14,'ydir','reverse','XAxisLocation','top','Xtick',[ 26.1 26.2 26.3 26.4],'XtickLabel',[]);
hold on
for t=15:length(prof_prov)
    plot([lon(t) lon(t)],[0 prof_prov(t)],'k--')
end
xlabel('Florida South Section')
ax2=gca;
set(ax2,'XAxisLocation','bottom');set(0,'DefaultTextFontSize',14);
set(0,'DefaultTextFontSize',14);
text(-80.03,-40,'80.0^oW');
text(-79.83,-40,'79.8^oW');
text(-79.63,-40,'79.6^oW');
text(-79.43,-40,'79.4^oW');
text(-79.23,-40,'79.2^oW');
%text(26.0,-20,'26.0^oW');
%text(-71.15,-40,'71^oW');
%text(-70.15,-40,'70^oW');
[C,h]=contour(lon_i,pressure,sigma0_i,cpd2,'k');
[C,h]=contour(lon_i,pressure,sigma0_i,cpd3,'k');
[C,h]=contour(lon_i,pressure,sigma0_i,[26 27],'k');
clabel(C,h);
ax1=gca;
set(ax1,'FontSize',14,'ydir','reverse','Xtick',[ 26.1 26.2 26.3 26.4],'XtickLabel',[]);
set(h,'LineWidth',2);
ylabel('Pressure (dbar)');
patch([lon(15:19)  -80.065 -80.065 -79.195 -79.195],[prof_prov(15:19) 153 800 800 155],'w','LineWidth',3);
text(-80.02,600,'Sigma0')
noaalogo([0.13 0.13 0.15 0.15])

%Ploting the oxygen
figure
oxygen_i=griddata(lon_prov,pressure_prov,oxygen_prov,lon_i',pressure);
oxygen_i(:,37)=oxygen_i(:,36);
oxygen_i(:,1)=oxygen_i(:,2);
coxy1=2.1:0.1:2.9;
coxy2=3.1:0.2:3.9;
coxy3=4.1:0.2:8.0;
c_color=[2:0.1:2.9 3.1:0.2:3.9 4.1:0.2:8.0 ];
contourf(lon_i,pressure,oxygen_i,c_color)
colormap(cejet)
colorbar
hold on
[C,h]=contour(lon_i,pressure,oxygen_i,coxy1,'k');
axis([-80.07 -79.19 0 800])
ax1=gca;
set(ax1,'FontSize',14,'ydir','reverse','XAxisLocation','top','Xtick',[ 26.1 26.2 26.3 26.4],'XtickLabel',[]);
hold on
for t=15:length(prof_prov)
    plot([lon(t) lon(t)],[0 prof_prov(t)],'k--')
end
xlabel('Florida South Section')
ax2=gca;
set(ax2,'XAxisLocation','bottom');set(0,'DefaultTextFontSize',14);
set(0,'DefaultTextFontSize',14);
text(-80.03,-40,'80.0^oW');
text(-79.83,-40,'79.8^oW');
text(-79.63,-40,'79.6^oW');
text(-79.43,-40,'79.4^oW');
text(-79.23,-40,'79.2^oW');
%text(26.0,-20,'26.0^oW');
%text(-71.15,-40,'71^oW');
%text(-70.15,-40,'70^oW');
%[C,h]=contour(lon_i,pressure,oxygen_i,coxy2,'k');
%[C,h]=contour(lon_i,pressure,oxygen_i,coxy3,'k');
[C,h]=contour(lon_i,pressure,oxygen_i,[2 3 4],'k');
clabel(C,h);
ax1=gca;
set(ax1,'FontSize',14,'ydir','reverse','Xtick',[ 26.1 26.2 26.3 26.4],'XtickLabel',[]);
set(h,'LineWidth',2);
ylabel('Pressure (dbar)');
patch([lon(15:19)  -80.065 -80.065 -79.195 -79.195],[prof_prov(15:19) 153 800 800 155],'w','LineWidth',3);
text(-80.02,600,'Dissolved Oxygen (ml/l)')
noaalogo([0.13 0.13 0.15 0.15])