-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotFinalField_exp2.m
137 lines (125 loc) · 4.56 KB
/
plotFinalField_exp2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
export = false;
%% Intepolate to full domain
M_int = 2:2:Jt - 1;
s_int = 3:2:Jt - 2;
s_intp = X;
s_intp(M_int, :) = (X(M_int - 1, :) + X(M_int + 1, :)) / 2;
M_intp = X;
M_intp(s_int, :) = (X(s_int - 1, :) + X(s_int + 1, :)) / 2;
Pres_intp = Pres* pb / 100;
Pres_intp(s_int, :) = (Pres_intp(s_int - 1, :) + Pres_intp(s_int + 1, :)) / 2;
Pres0_intp = Pres0* pb / 100;
Pres0_intp(s_int, :) = (Pres0_intp(s_int - 1, :) + Pres0_intp(s_int + 1, :)) / 2;
phi_intp = asind(s_intp);
Phi_intp = asind(YY);
u = Omega * Ae ...
* ((sind(phi_intp)) .^ 2 - (sind(Phi_intp)) .^ 2) ...
./ (cosd(phi_intp));
u = imgaussfilt(u, 1);
T = Th_pad .* (Pres_intp / (pb / 100)) .^ kappa;
T0 = Th_pad .* (Pres0_intp / (pb / 100)) .^ kappa;
DTDH = zeros(size(Pres_intp));
DTDH0 = zeros(size(Pres_intp));
DTDH(:, 3:end - 2) = (T(:, 4:end - 1) - T(:, 2:end - 3)) ./ ...
(R * T(:, 3:end - 2) / gr .* log(Pres_intp(:, 2:end - 3) ./ Pres_intp(:, 4:end - 1))) * 1000;
DTDH0(:, 3:end - 2) = (T0(:, 4:end - 1) - T0(:, 2:end - 3)) ./ ...
(R * T0(:, 3:end - 2) / gr .* log(Pres0_intp(:, 2:end - 3) ./ Pres0_intp(:, 4:end - 1))) * 1000;
%% Plot
figure(1)
clf
set(gca, "Box", "on", "LineWidth", 1, "FontSize", 9)
hold on
contourf(phi_intp, Pres0_intp, Th_pad, ...
300:0.5:311, "LineStyle", "none")
contour(phi_intp, Pres0_intp, Th_pad, ...
300:1:311, "LineColor", "k", "LineWidth", 0.5)
hold off
cbar = colorbar("Box", "on", "LineWidth", 1, "FontSize", 9);
% colormap()
clim([300, 311])
ylabel(cbar, 'Potential temperature [K]', "FontSize", 11)
xlim([phis, phin])
ylim([600, 1000])
xticks(-30:10:30)
xticklabels({'30°S', '20°S', '10°S', '0°', '10°N', '20°N', '30°N'})
yticks([600, 750, 850, 900, 950, 1000])
xlabel('Latitude', "FontSize", 11)
ylabel('Pressure [hPa]', "FontSize", 11)
box on
set(gca, "Ydir", "reverse", "YScale", "log", "Layer", "top")
set(gcf, "Position", [10 10 440 240], "Color", "w")
if export
export_fig(gcf, 'Figures/exp2_theta_initial', "-pdf", "-nocrop", "-nofontswap", "-painters")
end
figure(2)
clf
set(gca, "Box", "on", "LineWidth", 1, "FontSize", 9)
hold on
contourf(phi_intp, Pres_intp, Th_pad, ...
300:0.5:311, "LineStyle", "none")
contour(phi_intp, Pres_intp, Th_pad, ...
300:1:311, "LineColor", [0.5, 0.5, 0.5], "LineWidth", 0.5)
[C, h] = contour(phi_intp, Pres_intp, u, ...
-1:0.1:1, "LineColor", "k", "LineWidth", 0.5);
clabel(C, h, -1:0.2:1)
hold off
cbar = colorbar("Box", "on", "LineWidth", 1, "FontSize", 9);
% colormap()
clim([300, 311])
ylabel(cbar, 'Potential temperature [K]', "FontSize", 11)
xlim([phis, phin])
ylim([600, 1000])
xticks(-30:10:30)
xticklabels({'30°S', '20°S', '10°S', '0°', '10°N', '20°N', '30°N'})
yticks([600, 750, 850, 900, 950, 1000])
xlabel('Latitude', "FontSize", 11)
ylabel('Pressure [hPa]', "FontSize", 11)
box on
set(gca, "Ydir", "reverse", "YScale", "log", "Layer", "top")
set(gcf, "Position", [10 250 440 240], "Color", "w")
if export
export_fig(gcf, 'Figures/exp2_theta_final', "-pdf", "-nocrop", "-nofontswap", "-painters")
end
figure(3)
clf
set(gca, "Box", "on", "LineWidth", 1, "FontSize", 9)
hold on
plot(DTDH0(82, 3:end - 2), Pres0_intp(82, 3:end - 2), ...
"Color", "k", "LineWidth", 0.5, "DisplayName", 'initial')
plot(DTDH(82, 3:end - 2), Pres_intp(82, 3:end - 2), ...
"Color", "k", "LineWidth", 0.5, "Linestyle", "--", "DisplayName", 'final')
hold off
legend("show", "Box", "off", "FontSize", 11, "Location", "southeast")
xlim([-10, 5])
ylim([600, 1000])
yticks([600, 750, 850, 900, 950, 1000])
xlabel('Lapse rate [K/km]', "FontSize", 11)
ylabel('Pressure [hPa]', "FontSize", 11)
box on
set(gca, "Ydir", "reverse", "YScale", "log", "Layer", "top")
set(gcf, "Position", [450 10 160 240], "Color", "w")
if export
export_fig(gcf, 'Figures/exp2_lapserate_0', "-pdf", "-nocrop", "-nofontswap", "-painters")
end
figure(4)
clf
set(gca, "Box", "on", "LineWidth", 1, "FontSize", 9)
hold on
plot(DTDH0(41, 3:end - 2), Pres0_intp(41, 3:end - 2), ...
"Color", "k", "LineWidth", 0.5, "DisplayName", 'initial')
plot(DTDH(41, 3:end - 2), Pres_intp(41, 3:end - 2), ...
"Color", "k", "LineWidth", 0.5, "Linestyle", "--", "DisplayName", 'final')
hold off
legend("show", "Box", "off", "FontSize", 11, "Location", "southeast")
xlim([-10, 5])
ylim([600, 1000])
yticks([600, 750, 850, 900, 950, 1000])
xlabel('Lapse rate [K/km]', "FontSize", 11)
ylabel('Pressure [hPa]', "FontSize", 11)
ylabel('Pressure [hPa]', "FontSize", 11)
box on
set(gca, "Ydir", "reverse", "YScale", "log", "Layer", "top")
set(gcf, "Position", [450 250 160 240], "Color", "w")
if export
export_fig(gcf, 'Figures/exp2_lapserate_30', "-pdf", "-nocrop", "-nofontswap", "-painters")
end