Potential Temperature, Absolute Salinity and Potential Density

Tianyu Zhou, 10/20/2021, at UDel
Load data located within Nares Strait (pre-selected and stored in a '.mat' file) and perform quality control procedures.
clc;
clear;
load('../data/OMG_data_Nares')
data = output{2,5};
lon = -output{2,3};
lat = output{2,4};
depth_vec = data(:,2);
T_vec = data(:,3);
S_vec = data(:,5);
rho_vec = data(:,7);
flag = find(T_vec==-99|S_vec==-99|rho_vec==-99);
depth_vec(flag) = [];
T_vec(flag) = [];
S_vec(flag) = [];
rho_vec(flag) = [];
Convert in situ temperature to potential temperature (using the gsw toolbox), and estimate potential density at both zero and 1000-dbar pressure as well as the freezing point
P_vec = gsw_p_from_z(-depth_vec,lat); %pressure
SA_vec = gsw_SA_from_SP(S_vec,P_vec,lat,lon); %absolute salinity
pT_vec = gsw_pt_from_t(SA_vec,T_vec,P_vec,0); %potential temperature
CT_vec = gsw_CT_from_t(SA_vec,T_vec,P_vec); %conservative temperature
r0 = gsw_sigma0(SA_vec,CT_vec); %potential density to zero pressure
r1 = gsw_sigma1(SA_vec,CT_vec); %potential density to 1000-m pressure
tf = gsw_CT_freezing_poly(SA_vec,P_vec,1); %freezing point
Plot the profiles
% in situ vs. potential T
f = figure;
set(f,'units','centimeters','position',[1,1,9*1.2,12*1.2],'color','w')
FontSize = 15;
plot(T_vec,-depth_vec,'linewidth',1.5)
hold on
plot(pT_vec,-depth_vec,'linewidth',1.5)
xlim([-2 1])
ylim([-700 0])
box on
grid on
xlabel('Temperature (^{o}C)','FontWeight','bold')
ylabel('Depth (m)','FontWeight','bold')
legend({'in-situ','potential'},'Location','southwest')
set(gca,'FontSize',FontSize,'tickdir','out','xaxislocation','top')
% absolute S
f = figure;
set(f,'units','centimeters','position',[1,1,9*1.2,12*1.2],'color','w')
FontSize = 15;
plot(S_vec,-depth_vec,'linewidth',1.5)
hold on
plot(SA_vec,-depth_vec,'linewidth',1.5)
box on
grid on
xlabel('Salinity (ppt)','FontWeight','bold')
ylabel('Depth (m)','FontWeight','bold')
legend({'in-situ','absolute'},'Location','southwest')
set(gca,'FontSize',FontSize,'tickdir','out','xaxislocation','top')
% potential rho
f = figure;
set(f,'units','centimeters','position',[1,1,9*1.2,12*1.2],'color','w')
FontSize = 15;
plot(r0,-depth_vec,'linewidth',1.5)
hold on
plot(r1,-depth_vec,'linewidth',1.5)
box on
grid on
xlabel('Potential Density (Kg/m^{3})','FontWeight','bold')
ylabel('Depth (m)','FontWeight','bold')
legend({'0-m','1-km'},'Location','southwest')
set(gca,'FontSize',FontSize,'tickdir','out','xaxislocation','top')
% T diff between potential T and freezing point T
f = figure;
set(f,'units','centimeters','position',[1,1,9*1.2,12*1.2],'color','w')
FontSize = 15;
Tdiff = pT_vec-tf;
plot(Tdiff,-depth_vec,'linewidth',1.5)
hold on
plot(Tdiff(Tdiff<0),-depth_vec(Tdiff<0),'linewidth',1.5,'Color','r')
box on
grid on
xlabel('Temperature Difference (^{o}C)','FontWeight','bold')
ylabel('Depth (m)','FontWeight','bold')
set(gca,'FontSize',FontSize,'tickdir','out','xaxislocation','top')