% Program that plots sections for various parameters
%Shallow Section
clear prof
load ab0409_db.mat
pressure=1:800';
%load ctd.txt
%lon=-ctd(:,2);
%lat=ctd(:,1);
l=1;
for i=10:14
    lat(i)=cnv(i).lat;
   max_depth=find(cnv(i).data(:,2)==max(cnv(i).data(:,2)));
   prof_prov(i)=max_depth+20;
   for j=1:max_depth
   lat_prov(l)=lat(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
lat_i=lat(10)+0.01:-0.01:lat(14)-0.01;
pot_temp_i=griddata(lat_prov,pressure_prov,pot_temp_prov,lat_i',pressure,'v4');
c_color=[2:2:40];
contourf(lat_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(lat_i,pressure,pot_temp_i,c1,'k');
axis([26.047 26.452  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=10:length(prof_prov)
    plot([lat(t) lat(t)],[0 prof_prov(t)],'k--')
end
xlabel('Northwest Providence Channel Section')
ax2=gca;
set(ax2,'XAxisLocation','bottom');set(0,'DefaultTextFontSize',14);
set(0,'DefaultTextFontSize',14);
text(26.39,-20,'26.4^oN');
text(26.29,-20,'26.3^oN');
text(26.19,-20,'26.2^oN');
text(26.09,-20,'26.1^oN');
%text(26.0,-20,'26.0^oW');
%text(-71.15,-40,'71^oW');
%text(-70.15,-40,'70^oW');
[C,h]=contour(lat_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);
ylabel('Pressure (dbar)');
patch([lat(10:14) 26.05 26.05 26.45 26.45 ],[prof_prov(10:14) 280  800 800 770  ],'w','LineWidth',3);
text(26.1,600,'Potential Temperature [^{o}C]')
noaalogo([0.13 0.13 0.15 0.15])
%break
%Ploting the salinity
figure
sal_i=griddata(lat_prov,pressure_prov,sal_prov,lat_i',pressure,'v4');
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(lat_i,pressure,sal_i,c_color)
colormap(cejet)
colorbar
hold on

[C,h]=contour(lat_i,pressure,sal_i,csal1,'k');
axis([26.047 26.452  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=10:length(prof_prov)
    plot([lat(t) lat(t)],[0 prof_prov(t)],'k--')
end
xlabel('Northwest Providence Channel Section')
ax2=gca;
set(ax2,'XAxisLocation','bottom');set(0,'DefaultTextFontSize',14);
text(26.39,-20,'26.4^oN');
text(26.29,-20,'26.3^oN');
text(26.19,-20,'26.2^oN');
text(26.09,-20,'26.1^oN');
%text(26.0,-20,'26.0^oW');
%text(-71.15,-40,'71^oW');
%text(-70.15,-40,'70^oW');
[C,h]=contour(lat_i,pressure,sal_i,csal2,'k');
[C,h]=contour(lat_i,pressure,sal_i,csal3,'k');
[C,h]=contour(lat_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([lat(10:14) 26.05 26.05 26.45 26.45 ],[prof_prov(10:14) 280  800 800 770  ],'w','LineWidth',3);
text(26.1,600,'Salinity [psu]')
noaalogo([0.13 0.13 0.15 0.15])
%Ploting the potential density
figure
sigma0_i=griddata(lat_prov,pressure_prov,sigma0_prov,lat_i',pressure,'v4');
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(lat_i,pressure,sigma0_i,c_color)
colormap(cejet)
colorbar
hold on

[C,h]=contour(lat_i,pressure,sigma0_i,cpd1,'k');
axis([26.047 26.452  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=10:length(prof_prov)
    plot([lat(t) lat(t)],[0 prof_prov(t)],'k--')
end
xlabel('Northwest Providence Channel Section')
ax2=gca;
set(ax2,'XAxisLocation','bottom');set(0,'DefaultTextFontSize',14);
set(0,'DefaultTextFontSize',14);
text(26.39,-20,'26.4^oW');
text(26.29,-20,'26.3^oW');
text(26.19,-20,'26.2^oW');
text(26.09,-20,'26.1^oW');
%text(26.0,-20,'26.0^oW');
%text(-71.15,-40,'71^oW');
%text(-70.15,-40,'70^oW');
[C,h]=contour(lat_i,pressure,sigma0_i,cpd2,'k');
[C,h]=contour(lat_i,pressure,sigma0_i,cpd3,'k');
[C,h]=contour(lat_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([lat(10:14) 26.05 26.05 26.45 26.45 ],[prof_prov(10:14) 280  800 800 770  ],'w','LineWidth',3);
text(26.1,600,'Sigma0')
noaalogo([0.13 0.13 0.15 0.15])

%Ploting the oxygen
figure
oxygen_i=griddata(lat_prov,pressure_prov,oxygen_prov,lat_i',pressure,'v4');
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(lat_i,pressure,oxygen_i,c_color)
colormap(cejet)
colorbar
hold on
[C,h]=contour(lat_i,pressure,oxygen_i,coxy1,'k');
axis([26.047 26.452  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=10:length(prof_prov)
    plot([lat(t) lat(t)],[0 prof_prov(t)],'k--')
end
xlabel('Northwest Providence Channel Section')
ax2=gca;
set(ax2,'XAxisLocation','bottom');set(0,'DefaultTextFontSize',14);
set(0,'DefaultTextFontSize',14);
text(26.39,-20,'26.4^oW');
text(26.29,-20,'26.3^oW');
text(26.19,-20,'26.2^oW');
text(26.09,-20,'26.1^oW');
%text(26.0,-20,'26.0^oW');
%text(-71.15,-40,'71^oW');
%text(-70.15,-40,'70^oW');
%[C,h]=contour(lat_i,pressure,oxygen_i,coxy2,'k');
%[C,h]=contour(lat_i,pressure,oxygen_i,coxy3,'k');
[C,h]=contour(lat_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([lat(10:14) 26.05 26.05 26.45 26.45 ],[prof_prov(10:14) 280  800 800 770  ],'w','LineWidth',3);
text(26.1,600,'Dissolved Oxygen (ml/l)')
noaalogo([0.13 0.13 0.15 0.15])