%% Potential spiciness 
figure
pcolor(latitude,-zlev, ...
    squeeze(tau_remi_ref(661,:,:))');shading flat;
colorbar
cmocean('balance') 
caxis([-2 2])
axis([-80 70 -6000 0])
hold on
contour(latitude,-zlev,squeeze(tau_remi_ref(661,:,:))',...
    [-2:0.1:0.5], 'LineColor','k','ShowText','on')
contour(latitude,-zlev,squeeze(tau_remi_ref(661,:,:))',...
    [0.5:0.5:4], 'LineColor','k','ShowText','on') 
contour(latitude,-zlev,squeeze(tau_remi_ref(661,:,:))', ...
    [4:1:10], 'LineColor','k','ShowText','on') 
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [27:0.1:29],'LineColor',[0.6350 0.0780 0.1840]); 
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [26:0.2:27],'LineColor',[0.6350 0.0780 0.1840]);
xlabel('Latitude');ylabel('Depth (m)')
title('(a) - Potential spiciness (p_r = p_r(S_R,\Theta)) - 30 W')
fill(latlat,ztopzlow,[0.9 0.9 0.9])
hold off
print('pot_spiciness_1000','-depsc2') 

%% Reference Potential spicity 
figure
pcolor(latitude,-zlev,squeeze(pi_ref(661,:,:))');shading flat;colorbar
cmocean('balance')
caxis([-2 2])
axis([-80 70 -6000 0])
hold on
contour(latitude,-zlev,squeeze(pi_ref(661,:,:))', ...
    [-2:0.1:0.5], 'LineColor','k','ShowText','on')
contour(latitude,-zlev,squeeze(pi_ref(661,:,:))',...
    [0.5:0.5:4], 'LineColor','k','ShowText','on') 
contour(latitude,-zlev,squeeze(pi_ref(661,:,:))', ...
    [4:1:10], 'LineColor','k','ShowText','on') 
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [27:0.1:29],'LineColor',[0.6350 0.0780 0.1840]); 
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [26:0.2:27],'LineColor',[0.6350 0.0780 0.1840]);
xlabel('Latitude');ylabel('Depth (m)')
title('(b) - Potential spicity (p_r = p_r(S_R,\Theta)) - 30 W')
fill(latlat,ztopzlow,[0.9 0.9 0.9])
hold off
print('pot_spicity_pref','-depsc2') 

%% Potential spicity referenced to 1000 dbar
figure
pcolor(latitude,-zlev,squeeze(tau_huang(661,:,:))');
shading flat; colorbar; cmocean('balance') 
caxis([-2 2])
axis([-80 70 -6000 0])
hold on
contour(latitude,-zlev,squeeze(tau_huang(661,:,:))',...
    [-2:0.1:0.5], 'LineColor','k','ShowText','on')
contour(latitude,-zlev,squeeze(tau_huang(661,:,:))',...
    [0.5:0.5:4], 'LineColor','k','ShowText','on') 
contour(latitude,-zlev,squeeze(tau_huang(661,:,:))', ...
    [4:1:10],'LineColor','k','ShowText','on') 
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    27:0.1:33,'LineColor',[0.6350 0.0780 0.1840]); 
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    26:0.2:27,'LineColor',[0.6350 0.0780 0.1840]);
xlabel('Latitude');ylabel('Depth (m)')
title('(b) - Potential spicity (p_r = 1000 dbar) - 30 W')
fill(latlat,ztopzlow,[0.9 0.9 0.9])
hold off
print('pot_spicity_1000','-depsc2') 

%% Make plot of salinity 
figure 
pcolor(latitude,-zlev,squeeze(sr(661,:,:))');
shading flat; colorbar; cmocean('haline') 
axis([-80 70 -6000 0])
hold on
contour(latitude,-zlev,squeeze(sr(661,:,:))', ...
    [33:0.1:35.1],'LineColor','k','ShowText','on');
contour(latitude,-zlev,squeeze(sr(661,:,:))', ...
    [35:0.2:38],'LineColor','k','ShowText','on'); 
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [27:0.1:33],'LineColor','w');
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [26:0.2:27],'LineColor','w');
%[C2,h2]=contour(latitude(1:280),-zlev,squeeze(gammat(661,1:280,:))', ...
%    [27.4:0.1:29],'LineColor','w');
%clabel(C2,h2,'Color','w')
%[C3,h3]=contour(latitude(1:280),-zlev,squeeze(gammat(661,1:280,:))',...
%    [26:0.2:27.2],'w');
%clabel(C3,h3,'Color','w')
xlabel('Latitude');ylabel('Depth (m)')
title('(c) - Absolute Salinity - 30 W') 
caxis([34 36])
fill(latlat,ztopzlow,[0.9 0.9 0.9])
hold off
print('pot_salinity_1000','-depsc2') 

%% Make plot of Conservative Temperature
figure
pcolor(latitude,-zlev,squeeze(ct(661,:,:))');
shading flat; colorbar; cmocean('thermal')
axis([-80 70 -6000 0])
hold on
[C,h] = contour(latitude,-zlev,squeeze(ct(661,:,:))', ...
    [-2:10,10:2:30],'LineColor','m','ShowText','on'); 
clabel(C,h,'Color','m'); 
%contour(latitude(1:280),-zlev,squeeze(ct(661,1:280,:))', ...
%    [10:2.5:30],'LineColor','m','ShowText','on'); 
[C2,h2]=contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [27.4:0.1:29],'LineColor','w');
clabel(C2,h2,'Color','w')
[C3,h3]=contour(latitude,-zlev,squeeze(gammat(661,:,:))',...
    [26:0.2:27.2],'w');
clabel(C3,h3,'Color','w')
%contour(latitude(1:280),-zlev,squeeze(gammat(661,1:280,:))', ...
%    [27:0.1:33],'w');
%contour(latitude(1:280),-zlev,squeeze(gammat(661,1:280,:))', ...
%    [26:0.2:27.4],'w');
xlabel('Latitude');ylabel('Depth (m)')
title('(d) - Conservative Temperature - 30 W')
caxis([-2 20])
fill(latlat,ztopzlow,[0.9 0.9 0.9])
hold off
print('cons_temp_1000','-depsc2') 

%% Combine plots 
figure
subplot(2,2,1)
pcolor(latitude,-zlev, ...
    squeeze(tau_remi_ref(661,:,:))');shading flat;
colorbar
cmocean('balance') 
caxis([-2 2])
axis([-80 70 -6000 0])
%pbaspect([1.1 1 1]) 
hold on
[C5,h5]=contour(latitude,-zlev,squeeze(tau_remi_ref(661,:,:))',...
    [-2:0.1:0.5], 'LineColor','k','ShowText','on')
clabel(C5,h5,'FontSize',8)
[C5,h5]=contour(latitude,-zlev,squeeze(tau_remi_ref(661,:,:))',...
    [0.5:0.5:4], 'LineColor','k','ShowText','on') 
clabel(C5,h5,'FontSize',8)
[C5,h5]=contour(latitude,-zlev,squeeze(tau_remi_ref(661,:,:))', ...
    [4:1:10], 'LineColor','k','ShowText','on') 
clabel(C5,h5,'FontSize',8) 
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [27:0.1:29],'LineColor',[0.6350 0.0780 0.1840]); 
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [26:0.2:27],'LineColor',[0.6350 0.0780 0.1840]);
xlabel(['Latitude (' char(176) ' N)']);ylabel('Depth (m)')
title(['(a) QL Ref. Pot. spiciness - 30' ...
    char(176) ' W'])
set(gca,'FontSize',10)
fill(latlat,ztopzlow,[0.9 0.9 0.9])
hold off

subplot(2,2,2)
pcolor(latitude,-zlev,squeeze(pi_ref(661,:,:))');shading flat;colorbar
cmocean('balance')
caxis([-2 2])
axis([-80 70 -6000 0])
%pbaspect([1.1 1 1])
hold on
[C7,h7]=contour(latitude,-zlev,squeeze(pi_ref(661,:,:))', ...
    [-2:0.1:0.5], 'LineColor','k','ShowText','on');
clabel(C7,h7,'FontSize',8)
[C7,h7]=contour(latitude,-zlev,squeeze(pi_ref(661,:,:))',...
    [0.5:0.5:4], 'LineColor','k','ShowText','on');
clabel(C7,h7,'FontSize',8)
[C7,h7]=contour(latitude,-zlev,squeeze(pi_ref(661,:,:))', ...
    [4:1:10], 'LineColor','k','ShowText','on');
clabel(C7,h7,'FontSize',8)
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [27:0.1:29],'LineColor',[0.6350 0.0780 0.1840]); 
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [26:0.2:27],'LineColor',[0.6350 0.0780 0.1840]);
xlabel(['Latitude (' char(176) ' N)']);ylabel('Depth (m)')
title(['(b) Ref. Pot. spicity - 30' char(176) ...
    ' W'])
set(gca,'FontSize',10)
fill(latlat,ztopzlow,[0.9 0.9 0.9])
hold off

subplot(2,2,3)
pcolor(latitude,-zlev,squeeze(sr(661,:,:))');
shading flat; colorbar; cmocean('haline') 
axis([-80 70 -6000 0])
%pbaspect([1.1 1 1])
hold on
[C8,h8]=contour(latitude,-zlev,squeeze(sr(661,:,:))', ...
    [33:0.1:35.1],'LineColor','k','ShowText','on');
clabel(C8,h8,'FontSize',8)
[C9,h9]=contour(latitude,-zlev,squeeze(sr(661,:,:))', ...
    [35:0.2:38],'LineColor','k','ShowText','on'); 
clabel(C9,h9,'FontSize',8)
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [27:0.1:33],'LineColor','w');
contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [26:0.2:27],'LineColor','w');
%[C2,h2]=contour(latitude(1:280),-zlev,squeeze(gammat(661,1:280,:))', ...
%    [27.4:0.1:29],'LineColor','w');
%clabel(C2,h2,'Color','w')
%[C3,h3]=contour(latitude(1:280),-zlev,squeeze(gammat(661,1:280,:))',...
%    [26:0.2:27.2],'w');
%clabel(C3,h3,'Color','w')
xlabel(['Latitude (' char(176) ' N)']);ylabel('Depth (m)')
title(['(c) Abs. Salinity - 30' char(176) ' W']) 
set(gca,'FontSize',10)
caxis([34 36])
fill(latlat,ztopzlow,[0.9 0.9 0.9])
hold off

subplot(2,2,4)
pcolor(latitude,-zlev,squeeze(ct(661,:,:))');
shading flat; colorbar; cmocean('thermal')
axis([-80 70 -6000 0])
%pbaspect([1.1 1 1])
hold on
[C,h] = contour(latitude,-zlev,squeeze(ct(661,:,:))', ...
    [-2:10,10:2:30],'LineColor','m','ShowText','on'); 
clabel(C,h,'Color','m','FontSize',8); 
%contour(latitude(1:280),-zlev,squeeze(ct(661,1:280,:))', ...
%    [10:2.5:30],'LineColor','m','ShowText','on'); 
[C2,h2]=contour(latitude,-zlev,squeeze(gammat(661,:,:))', ...
    [27.4:0.1:29],'LineColor','w');
clabel(C2,h2,'Color','w','FontSize',8)
[C3,h3]=contour(latitude,-zlev,squeeze(gammat(661,:,:))',...
    [26:0.2:27.2],'w');
clabel(C3,h3,'Color','w','FontSize',8)
%contour(latitude(1:280),-zlev,squeeze(gammat(661,1:280,:))', ...
%    [27:0.1:33],'w');
%contour(latitude(1:280),-zlev,squeeze(gammat(661,1:280,:))', ...
%    [26:0.2:27.4],'w');
xlabel(['Latitude (' char(176) ' N)']);ylabel('Depth (m)')
title(['(d) Cons. Temperature - 30' char(176) ' W'])
caxis([-2 20])
set(gca,'FontSize',10)
fill(latlat,ztopzlow,[0.9 0.9 0.9])
hold off

print('fig01_10pt.eps','-depsc2') 
