Skip to content

Commit 9fbf74d

Browse files
committed
Update Matlab script for Fig.5
1 parent 30e3f45 commit 9fbf74d

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

Run/FIG05_PassiveParticles_vs_SuperIndividuals.m

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
%--------------------------------------------------------------------------
1010
% Writen by Iria Sala
1111
% Created on 09.02.2023
12+
% Edited by Bingzhang Chen (bingzhang.chen@strath.ac.uk) on 28.04.2025
1213
%==========================================================================
1314

1415
%==========================================================================
@@ -17,17 +18,17 @@
1718
%..........................................................................
1819
EUL = 'Euler.nc';
1920
%..........................................................................
20-
Z_w = double(nc_varget(EUL,'Z_w')); % Depth (m)
21-
Kv = double(nc_varget(EUL,'Kv')); % Vertical diffusivity (Kv, m2 s-1)
21+
Z_w = double(ncread(EUL,'Z_w')); % Depth (m)
22+
Kv = double(ncread(EUL,'Kv')); % Vertical diffusivity (Kv, m2 s-1)
2223
%..........................................................................
2324
DMLD = 1:365; % Time vector (day)
2425
%..........................................................................
2526
% Find the closest values to 10-4 to define the MLD:
26-
val = 10e-4;
27+
val = 1e-4;
2728
%..........................................................................
2829
for d = 1:365
2930

30-
prof = Kv(d,:);
31+
prof = Kv(:,d);
3132
[nu,ix] = min(abs(prof-val));
3233

3334
zdep = Z_w(ix);
@@ -40,23 +41,23 @@
4041
%==========================================================================
4142
%% Load Lagrangian fields:
4243
%==========================================================================
43-
LAG = 'ParY6.nc';
44+
LAG = 'ParY6.nc'; %Download from https://strath-my.sharepoint.com/:u:/g/personal/bingzhang_chen_strath_ac_uk/EWzT89WKyYxOg_vAfbnhuzsBGCK371cdqmuk3Zik4-boUQ?e=e6Lb1P
4445
%..........................................................................
45-
DAYS = double(nc_varget(LAG,'DOY'))'; % Time (hours)
46+
DAYS = double(ncread(LAG,'DOY'))'; % Time (hours)
4647
tPART = DAYS;
4748
%..........................................................................
48-
zPART = double(nc_varget(LAG,'Z'))'; % Super-individuals depth position
49+
zPART = double(ncread(LAG,'Z'))'; % Super-individuals depth position
4950
%==========================================================================
5051

5152
%==========================================================================
5253
%% Load Pasive particles fields:
5354
%==========================================================================
54-
PAS = 'PassY6.nc';
55+
PAS = 'PassY6.nc'; %Download from https://strath-my.sharepoint.com/:u:/g/personal/bingzhang_chen_strath_ac_uk/EUeaWW_WmypMrFoiK5W34tMBVD6wxhtOGFIB6BvpEy94jw?e=Cq4IUb
5556
%..........................................................................
56-
DAYS = double(nc_varget(PAS,'DOY'))'; % Time (days)
57+
DAYS = double(ncread(PAS,'DOY'))'; % Time (days)
5758
tPASS = DAYS;
5859
%..........................................................................
59-
zPASS = double(nc_varget(PAS,'Z'))'; % Passive particle depth position
60+
zPASS = double(ncread(PAS,'Z'))'; % Passive particle depth position
6061
%==========================================================================
6162

6263
%==========================================================================
@@ -78,8 +79,8 @@
7879
%==========================================================================
7980
for j = 1:length(D05)-1
8081

81-
zSI = zPART(:,D05(j):D05(j)+4);
82-
zPP = zPASS(:,D05(j):D05(j)+4);
82+
zSI = zPART(D05(j):D05(j)+4,:);
83+
zPP = zPASS(D05(j):D05(j)+4,:);
8384

8485
% Select super-individuals by depth level:
8586
for i = 1:length(Z_w)-1
@@ -208,6 +209,7 @@
208209
set(gcf, 'PaperSize', [figPosition(3) figPosition(4)]);
209210
%..........................................................................
210211
% Save the figure as a PDF using the print command
211-
print(gcf, 'FIG05_SupIndvsPasPar.pdf', '-dpdf', '-bestfit');
212+
exportgraphics(gcf, 'FIG05_SupIndvsPasPar.pdf', 'ContentType', 'vector');
213+
close all;
212214
%==========================================================================
213215
return

0 commit comments

Comments
 (0)