Surface Mixed Layer

Tianyu Zhou, 11/03/2021, at UDel

Quality Control and Binning

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')
profi_num = size(output,1);
depth = cell(profi_num,1);
T = cell(profi_num,1);
S = cell(profi_num,1);
rho = cell(profi_num,1);
for n = 1:profi_num
data = output{n,5};
% NOTE: a small percentage of probes do not have salinity or density data!
if size(data,2) == 8
% for these who have salinity or density data
% Quality control (step1): remove -99 data values
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) = [];
% Quality control (step2): binning
% binning is performed by fun_binning (see the appendix)
[T_vec,S_vec,rho_vec,depth_vec] = fun_binning(T_vec,S_vec,rho_vec,depth_vec);
depth{n} = depth_vec; % m
T{n} = T_vec; % oC
S{n} = S_vec; % ppt
rho{n} = rho_vec; % kg/m3
else
% for these who do not have salinity or density data
% Quality control (step1): remove -99 data values
depth_vec = data(:,3);
T_vec = data(:,4);
S_vec = nan;
rho_vec = nan;
flag = find(T_vec==-99);
depth_vec(flag) = [];
T_vec(flag) = [];
% Quality control (step2): binning
% binning is performed by fun_binning (see the appendix)
[T_vec,S_vec,rho_vec,depth_vec] = fun_binning(T_vec,S_vec,rho_vec,depth_vec);
depth{n} = depth_vec;
T{n} = T_vec;
S{n} = S_vec;
rho{n} = rho_vec;
end
end
depth = cell2mat(depth);
T = cell2mat(T);
S = cell2mat(S);
rho = cell2mat(rho);

Calculate the Mixed Layer Depth (MLD) for One Cast

Use the definition of Martin (1985): SST+0.1 (note that -0.1 is modified to be +0.1)
% select one cast and find SST
cast = 5;
SST = T(cast,1);
% find MLD
MLD_index = find(T(cast,:)>=SST+0.1,1,'first');
MLD = depth(cast,MLD_index)
MLD = 51
% calculate absolute salinity and potential temperature
lat = output{cast,4};
lon = -output{cast,3};
P = gsw_p_from_z(-depth(cast,:),lat); %pressure
SA = gsw_SA_from_SP(S(cast,:),P,lat,lon); %absolute salinity
pT = gsw_pt_from_t(SA,T(cast,:),P,0); %potential temperature
% calculate the mean and sd of SA and pT within the SML
mean_pT_SML = mean(pT(1:MLD_index),'omitnan')
mean_pT_SML = -1.6160
sd_pT_SML = std(pT(1:MLD_index),'omitnan')
sd_pT_SML = 0.0176
mean_SA_SML = mean(SA(1:MLD_index),'omitnan')
mean_SA_SML = 29.7687
sd_SA_SML = std(SA(1:MLD_index),'omitnan')
sd_SA_SML = 0.2551
% plotting surface values: Potential Temperature
f = figure;
set(f,'units','centimeters','position',[1,1,9*1.2,12*1.2],'color','w')
FontSize = 15;
plot(pT(1:MLD_index+105),-depth(cast,1:MLD_index+105),'linewidth',1.5)
hold on
plot([pT(MLD_index),pT(MLD_index)],[-depth(cast,1),-depth(cast,MLD_index+105)],'--k','linewidth',1.5)
plot([-2 -0.3],[-MLD,-MLD],'--k','linewidth',1.5)
plot(pT(MLD_index),-depth(cast,MLD_index),'r.','MarkerSize',20)
xlim([-2 -0.3])
box on
grid on
xlabel('Potential Temperature (^{o}C)','FontWeight','bold')
ylabel('Depth (m)','FontWeight','bold')
set(gca,'FontSize',FontSize,'tickdir','out','xaxislocation','top')
% plotting surface values: Absolute Salinity
f = figure;
set(f,'units','centimeters','position',[1,1,9*1.2,12*1.2],'color','w')
FontSize = 15;
plot(SA(1:MLD_index+105),-depth(cast,1:MLD_index+105),'linewidth',1.5)
hold on
plot([SA(MLD_index),SA(MLD_index)],[-depth(cast,1),-depth(cast,MLD_index+105)],'--k','linewidth',1.5)
plot([28 35],[-MLD,-MLD],'--k','linewidth',1.5)
plot(SA(MLD_index),-depth(cast,MLD_index),'r.','MarkerSize',20)
xlim([28 35])
box on
grid on
xlabel('Absolute Salinity (ppt)','FontWeight','bold')
ylabel('Depth (m)','FontWeight','bold')
set(gca,'FontSize',FontSize,'tickdir','out','xaxislocation','top')
% plotting surface values: Density
f = figure;
set(f,'units','centimeters','position',[1,1,9*1.2,12*1.2],'color','w')
FontSize = 15;
plot(rho(cast,1:MLD_index+105),-depth(cast,1:MLD_index+105),'linewidth',1.5)
hold on
plot([rho(cast,MLD_index),rho(cast,MLD_index)],[-depth(cast,1),-depth(cast,MLD_index+105)],'--k','linewidth',1.5)
plot([1023 1028.6],[-MLD,-MLD],'--k','linewidth',1.5)
plot(rho(cast,MLD_index),-depth(cast,MLD_index),'r.','MarkerSize',20)
xlim([1023 1028.6])
box on
grid on
xlabel('Density (kg/m^{3})','FontWeight','bold')
ylabel('Depth (m)','FontWeight','bold')
set(gca,'FontSize',FontSize,'tickdir','out','xaxislocation','top')
% calculate and plot the stability frequency
CT = gsw_CT_from_t(SA,T(cast,:),P); %conservative temperature
[N2, p_mid] = gsw_Nsquared(SA,CT,P,lat);
f = figure;
set(f,'units','centimeters','position',[1,1,9*1.2,12*1.2],'color','w')
FontSize = 15;
plot(N2(1:MLD_index+105),-depth(cast,1:MLD_index+105),'linewidth',1.5)
hold on
plot(10^-3*[0 2],[-MLD,-MLD],'--k','linewidth',1.5)
box on
grid on
xlim(10^-3*[0 2])
xlabel('N^{2} (s^{-2})','FontWeight','bold')
ylabel('Depth (m)','FontWeight','bold')
set(gca,'FontSize',FontSize,'tickdir','out','xaxislocation','top')

Calculate the Mixed Layer Depth (MLD) for All Casts

Use the definition of Martin (1985): SST+0.1 (note that -0.1 is modified to be +0.1)
MLD = ones(profi_num,1);
mean_SA_SML = ones(profi_num,1);
mean_pT_SML = ones(profi_num,1);
mean_rho = ones(profi_num,1);
for cast = 1:profi_num
SST = T(cast,1);
% find MLD
MLD_index = find(T(cast,:)>=SST+0.1,1,'first');
if isempty(MLD_index) || MLD_index == 999
MLD(cast) = nan;
mean_SA_SML(cast) = nan;
mean_pT_SML(cast) = nan;
else
MLD(cast) = depth(cast,MLD_index);
% calculate absolute salinity and potential temperature
lat = output{cast,4};
lon = -output{cast,3};
P = gsw_p_from_z(-depth(cast,:),lat); %pressure
SA = gsw_SA_from_SP(S(cast,:),P,lat,lon); %absolute salinity
pT = gsw_pt_from_t(SA,T(cast,:),P,0); %potential temperature
mean_SA_SML(cast) = mean(SA(1:MLD_index),'omitnan');
mean_pT_SML(cast) = mean(pT(1:MLD_index),'omitnan');
mean_rho(cast) = mean(rho(1:MLD_index),'omitnan');
end
end
mean_pT_SML(isnan(MLD)) = [];
mean_SA_SML(isnan(MLD)) = [];
mean_rho(isnan(MLD)) = [];
MLD(isnan(MLD)) = [];
% make scatterplots: T-S
f = figure;
set(f,'units','centimeters','position',[1,1,15.5*1.5,10*1.5],'color','w')
FontSize = 20;
color = jet(300);
for n = 1:size(MLD,1)
plot(mean_SA_SML(n),mean_pT_SML(n),'.','color',color(MLD(n),:),'MarkerSize',15)
hold on
end
colormap("jet")
colorbar
caxis([1 300])
xlabel('Mean Absolute Salinity (ppt)','FontWeight','bold')
ylabel('Mean Potential Temperature (^{o}C)','FontWeight','bold')
title('MLD (m) and Averaged Water Properties','FontWeight','bold')
set(gca,'FontSize',FontSize,'tickdir','out')
% make scatterplots: rho vs MLD
f = figure;
set(f,'units','centimeters','position',[1,1,15.5*1.5,10*1.5],'color','w')
FontSize = 20;
plot(MLD,mean_rho,'.','MarkerSize',15)
xlabel('Mixed Layer Depth (m)','FontWeight','bold')
ylabel('Mean Density (kg/m^{3})','FontWeight','bold')
set(gca,'FontSize',FontSize,'tickdir','out')