Skip to content

Commit 3e7ec55

Browse files
committed
update docs/src/plots scripts formatting
1 parent 4d7d5fb commit 3e7ec55

37 files changed

+461
-546
lines changed

box/Alpert_Knopf_2016_backward.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ J_immer = @. CMI_het.ABIFM_J(aerosol, Δa) # m^-2 s^-1
9595

9696
#! format: off
9797
# Plot results
98-
fig = MK.Figure(resolution = (1200, 400))
98+
fig = MK.Figure(size = (1200, 400))
9999
ax1 = MK.Axis(fig[1, 1], ylabel = "J_immer [cm^-2 s^-1]", xlabel = "Temperature [K]", yscale = log10)
100100
ax2 = MK.Axis(fig[1, 2], ylabel = "frozen fraction", xlabel = "Temperature [K]")
101101
ax3 = MK.Axis(fig[1, 3], ylabel = "total A [cm^2]", xlabel = "Temperature [K]", yscale = log10)

box/Alpert_Knopf_2016_forward.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ff_var = @. frozen_frac(sol_var[4, :], sol_var[3, :])
6666

6767
#! format: off
6868
# Plot results
69-
fig = MK.Figure(resolution = (1200, 400))
69+
fig = MK.Figure(size = (1200, 400))
7070
ax1 = MK.Axis(fig[1, 1], ylabel = "J_immer [cm^-2 s^-1]", xlabel = "Temperature [K]", yscale = log10)
7171
ax2 = MK.Axis(fig[1, 2], ylabel = "frozen fraction", xlabel = "Temperature [K]")
7272
ax3 = MK.Axis(fig[1, 3], ylabel = "total A [cm2]", xlabel = "Temperature [K]", yscale = log10)

docs/src/plots/ARGplots.jl

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
import Plots
21

3-
import CloudMicrophysics
4-
import ClimaParams
5-
import Thermodynamics
2+
import Plots as PL
63

7-
const PL = Plots
8-
const AM = CloudMicrophysics.AerosolModel
9-
const AA = CloudMicrophysics.AerosolActivation
10-
const CP = ClimaParams
11-
const CMP = CloudMicrophysics.Parameters
12-
const TD = Thermodynamics
4+
import Thermodynamics as TD
5+
6+
import CloudMicrophysics.AerosolModel as AM
7+
import CloudMicrophysics.AerosolActivation as AA
8+
import CloudMicrophysics.Parameters as CMP
139

14-
FT = Float64
1510

16-
tps = Thermodynamics.Parameters.ThermodynamicsParameters(FT)
11+
FT = Float64
12+
tps = TD.Parameters.ThermodynamicsParameters(FT)
1713
aip = CMP.AirProperties(FT)
1814
ap = CMP.AerosolActivationParameters(FT)
1915

docs/src/plots/ARGplots_fig1.jl

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import Plots
21

3-
import CloudMicrophysics
4-
import ClimaParams
5-
import Thermodynamics
2+
import Plots as PL
3+
4+
import Thermodynamics as TD
5+
6+
import CloudMicrophysics.AerosolModel as AM
7+
import CloudMicrophysics.AerosolActivation as AA
8+
import CloudMicrophysics.Parameters as CMP
69

7-
const PL = Plots
8-
const AM = CloudMicrophysics.AerosolModel
9-
const AA = CloudMicrophysics.AerosolActivation
10-
const CMP = CloudMicrophysics.Parameters
11-
const TD = Thermodynamics
1210

1311
FT = Float64
14-
tps = Thermodynamics.Parameters.ThermodynamicsParameters(FT)
12+
tps = TD.Parameters.ThermodynamicsParameters(FT)
1513
aip = CMP.AirProperties(FT)
1614
ap = CMP.AerosolActivationParameters(FT)
1715

docs/src/plots/Baumgartner2022_fig5.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import RootSolvers as RS
22
import CairoMakie as MK
33

4-
import CloudMicrophysics as CM
54
import Thermodynamics as TD
6-
import ClimaParams as CP
75

8-
const CMO = CM.Common
9-
const CMP = CM.Parameters
6+
import CloudMicrophysics.Common as CO
7+
import CloudMicrophysics.Parameters as CMP
108

119
FT = Float64
1210
tps = TD.Parameters.ThermodynamicsParameters(FT)
@@ -54,12 +52,12 @@ a_w_Nach = [Δa_crit + (Baumgartner_p_ice(T)) / (Nach_p_liq(T)) for T in T_range
5452
a_w_Luo = [
5553
Δa_crit +
5654
(Baumgartner_p_ice(T)) /
57-
(CMO.H2SO4_soln_saturation_vapor_pressure(H2SO4_prs, 0.0, T)) for
55+
(CO.H2SO4_soln_saturation_vapor_pressure(H2SO4_prs, 0.0, T)) for
5856
T in T_range
5957
]
6058

6159
#! format: off
62-
fig = MK.Figure(resolution = (800, 600))
60+
fig = MK.Figure(size = (800, 600))
6361
ax1 = MK.Axis(fig[1, 1], title = "Water Activity vs Temperature", ylabel = "a_w [-]", xlabel = "T [K]")
6462
MK.lines!(ax1, BG2022_fig5_T, BG2022_fig5_aw, label = "Baumgartner2022", linestyle = :dash, color = :blue)
6563
MK.lines!(ax1, T_range, a_w, label = "CloudMicrophysics", color = :blue)
@@ -70,7 +68,7 @@ MK.lines!(ax1, T_range, a_w_ice, label = "a_w_ice", color = :red)
7068
MK.axislegend(position = :lt)
7169
MK.save("Baumgartner2022_fig5.svg", fig)
7270

73-
fig = MK.Figure(resolution = (800, 600))
71+
fig = MK.Figure(size = (800, 600))
7472
ax1 = MK.Axis(fig[1, 1], title = "Saturated Vapor Pressure vs Temperature", ylabel = "Pressure [Pa]", xlabel = "T [K]")
7573
MK.lines!(ax1, T_range, [Baumgartner_p_ice(T) for T in T_range], label = "Baumgartner's p_ice", color = :blue, linestyle = :dash)
7674
MK.lines!(ax1, T_range, p_sat_ice, label = "CM's p_ice", color = :blue)

docs/src/plots/CLOUD_Nucleation_Plots.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using Plots
1+
import Plots
22

3-
import ClimaParams as CP
43
import CloudMicrophysics.Parameters as CMP
5-
import CloudMicrophysics.Nucleation as Nucleation
4+
import CloudMicrophysics.Nucleation
65

76
FT = Float64
87
params = CMP.H2S04NucleationParameters(FT)

docs/src/plots/Cholette2019_fig1.jl

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import ClimaParams
2-
import CloudMicrophysics as CM
1+
import CairoMakie as MK
2+
33
import CloudMicrophysics.P3Scheme as P3
44
import CloudMicrophysics.Parameters as CMP
5-
import CloudMicrophysics.Common as CO
6-
import CairoMakie as Plt
7-
8-
const PSP3 = CMP.ParametersP3
5+
import CloudMicrophysics.Parameters.ParametersP3 as PSP3
96

107
FT = Float64
118

@@ -72,10 +69,10 @@ function fig1()
7269
colors = [:black, :blue, :red, :green]
7370
res = 50
7471

75-
fig = Plt.Figure(size = (1200, 400))
72+
fig = MK.Figure(size = (1200, 400))
7673

7774
#F_r = 0
78-
ax1 = Plt.Axis(
75+
ax1 = MK.Axis(
7976
fig[1:7, 1:9],
8077
title = "Fᵣ = 0",
8178
xlabel = "Dₚ (m)",
@@ -92,8 +89,8 @@ function fig1()
9289
P3.thresholds(p3, ρ_r, F_rs[1]),
9390
res,
9491
)
95-
Plt.lines!(ax1, D_ps, V_0_ϕ, color = colors[i], label = labels[i])
96-
Plt.lines!(
92+
MK.lines!(ax1, D_ps, V_0_ϕ, color = colors[i], label = labels[i])
93+
MK.lines!(
9794
ax1,
9895
D_ps,
9996
V_0,
@@ -104,7 +101,7 @@ function fig1()
104101
end
105102

106103
# F_r = 1
107-
ax2 = Plt.Axis(
104+
ax2 = MK.Axis(
108105
fig[1:7, 10:18],
109106
title = "Fᵣ = 1",
110107
xlabel = "Dₚ (m)",
@@ -120,8 +117,8 @@ function fig1()
120117
P3.thresholds(p3, ρ_r, F_rs[2]),
121118
res,
122119
)
123-
Plt.lines!(ax2, D_ps, V_1_ϕ, color = colors[i], label = labels[i])
124-
Plt.lines!(
120+
MK.lines!(ax2, D_ps, V_1_ϕ, color = colors[i], label = labels[i])
121+
MK.lines!(
125122
ax2,
126123
D_ps,
127124
V_1,
@@ -131,20 +128,20 @@ function fig1()
131128
)
132129
end
133130

134-
Plt.Legend(
131+
MK.Legend(
135132
fig[4, 19:22],
136133
[
137-
Plt.LineElement(color = :black),
138-
Plt.LineElement(color = :blue),
139-
Plt.LineElement(color = :red),
140-
Plt.LineElement(color = :green),
141-
Plt.LineElement(color = :black, linestyle = :dash),
134+
MK.LineElement(color = :black),
135+
MK.LineElement(color = :blue),
136+
MK.LineElement(color = :red),
137+
MK.LineElement(color = :green),
138+
MK.LineElement(color = :black, linestyle = :dash),
142139
],
143140
labels,
144141
framevisible = false,
145142
)
146143

147-
Plt.linkaxes!(ax1, ax2)
144+
MK.linkaxes!(ax1, ax2)
148145
ax1.xticks = (
149146
[0, 0.002, 0.004, 0.006, 0.008, 0.01],
150147
string.([0, 0.002, 0.004, 0.006, 0.008, 0.01]),
@@ -155,8 +152,8 @@ function fig1()
155152
)
156153

157154

158-
Plt.resize_to_layout!(fig)
159-
Plt.save("Choletteetal2019_fig1.svg", fig)
155+
MK.resize_to_layout!(fig)
156+
MK.save("Choletteetal2019_fig1.svg", fig)
160157
end
161158

162159
fig1()

docs/src/plots/CloudDiagnostics.jl

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import CairoMakie as PL
2-
PL.activate!(type = "svg")
1+
import CairoMakie as MK
2+
MK.activate!(type = "svg")
33

44
import ClimaParams as CP
55

@@ -16,11 +16,7 @@ cloud_liquid = CMP.CloudLiquid(FT)
1616
cloud_ice = CMP.CloudIce(FT)
1717

1818
override_file = joinpath(
19-
pkgdir(CloudMicrophysics),
20-
"src",
21-
"parameters",
22-
"toml",
23-
"SB2006_limiters.toml",
19+
pkgdir(CloudMicrophysics), "src", "parameters", "toml", "SB2006_limiters.toml",
2420
)
2521
toml_dict = CP.create_toml_dict(FT; override_file)
2622
SB = CMP.SB2006(toml_dict)
@@ -54,35 +50,35 @@ reff_2M_100_LH = [CMD.effective_radius_Liu_Hallet_97(cloud_liquid, ρ_air, q_li
5450
reff_2M_1000_LH = [CMD.effective_radius_Liu_Hallet_97(cloud_liquid, ρ_air, q_liq, FT(1000 * 1e6), FT(0), FT(0)) for q_liq in q_liq_range]
5551

5652
# plotting
57-
fig = PL.Figure(size = (1100, 1000), fontsize=22, linewidth=3)
53+
fig = MK.Figure(size = (1100, 1000), fontsize=22, linewidth=3)
5854

59-
ax1 = PL.Axis(fig[1, 1])
60-
ax2 = PL.Axis(fig[2, 1])
55+
ax1 = MK.Axis(fig[1, 1])
56+
ax2 = MK.Axis(fig[2, 1])
6157

62-
PL.ylims!(ax2, [-50, 40])
58+
MK.ylims!(ax2, [-50, 40])
6359

6460
ax1.xlabel = "q_liq [g/kg]"
6561
ax1.ylabel = "effective radius [μm]"
6662
ax2.xlabel = "q_rai [g/kg]"
6763
ax2.ylabel = "radar reflectivity [dBZ]"
6864

69-
#p_reff_2M_100 = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_100 * 1e6, color = :blue, linestyle = :dot)
70-
#p_reff_2M_1000 = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_1000 * 1e6, color = :skyblue1, linestyle = :dot)
71-
p_reff_2M_100_nolim = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_100_nolim * 1e6, color = :blue)
72-
p_reff_2M_100_LH = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_100_LH * 1e6, color = :crimson)
65+
#p_reff_2M_100 = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_100 * 1e6, color = :blue, linestyle = :dot)
66+
#p_reff_2M_1000 = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_1000 * 1e6, color = :skyblue1, linestyle = :dot)
67+
p_reff_2M_100_nolim = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_100_nolim * 1e6, color = :blue)
68+
p_reff_2M_100_LH = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_100_LH * 1e6, color = :crimson)
7369

74-
p_reff_2M_1000_nolim = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_1000_nolim * 1e6, color = :skyblue1)
75-
p_reff_2M_1000_LH = PL.lines!(ax1, q_liq_range * 1e3, reff_2M_1000_LH * 1e6, color = :orange)
70+
p_reff_2M_1000_nolim = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_1000_nolim * 1e6, color = :skyblue1)
71+
p_reff_2M_1000_LH = MK.lines!(ax1, q_liq_range * 1e3, reff_2M_1000_LH * 1e6, color = :orange)
7672

77-
p_Z_1M = PL.lines!(ax2, q_rain_range * 1e3, Z_1M, color = :green)
73+
p_Z_1M = MK.lines!(ax2, q_rain_range * 1e3, Z_1M, color = :green)
7874

79-
p_Z_2M_100 = PL.lines!(ax2, q_rain_range * 1e3, Z_2M_100, color = :skyblue1, linestyle = :dot)
80-
p_Z_2M_100_nolim = PL.lines!(ax2, q_rain_range * 1e3, Z_2M_100_nolim, color = :skyblue1)
75+
p_Z_2M_100 = MK.lines!(ax2, q_rain_range * 1e3, Z_2M_100, color = :skyblue1, linestyle = :dot)
76+
p_Z_2M_100_nolim = MK.lines!(ax2, q_rain_range * 1e3, Z_2M_100_nolim, color = :skyblue1)
8177

82-
p_Z_2M_10 = PL.lines!(ax2, q_rain_range * 1e3, Z_2M_10, color = :blue, linestyle = :dot)
83-
p_Z_2M_10_nolim = PL.lines!(ax2, q_rain_range * 1e3, Z_2M_10_nolim, color = :blue)
78+
p_Z_2M_10 = MK.lines!(ax2, q_rain_range * 1e3, Z_2M_10, color = :blue, linestyle = :dot)
79+
p_Z_2M_10_nolim = MK.lines!(ax2, q_rain_range * 1e3, Z_2M_10_nolim, color = :blue)
8480

85-
PL.Legend(
81+
MK.Legend(
8682
fig[1, 2],
8783
[p_reff_2M_100_nolim, p_reff_2M_100_LH, p_reff_2M_1000_nolim, p_reff_2M_1000_LH],
8884
[
@@ -93,7 +89,7 @@ PL.Legend(
9389
],
9490
framevisible = false,
9591
)
96-
PL.Legend(
92+
MK.Legend(
9793
fig[2, 2],
9894
[p_Z_1M, p_Z_2M_100, p_Z_2M_100_nolim, p_Z_2M_10, p_Z_2M_10_nolim],
9995
[
@@ -108,4 +104,4 @@ PL.Legend(
108104

109105
#! format: on
110106

111-
PL.save("CloudDiagnostics.svg", fig)
107+
MK.save("CloudDiagnostics.svg", fig)

docs/src/plots/Frostenberg_fig1.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import Plots as PL
22

3-
import CloudMicrophysics as CM
43
import CloudMicrophysics.HetIceNucleation as IN
5-
import ClimaParams as CP
64
import CloudMicrophysics.Parameters as CMP
75

86
FT = Float32

docs/src/plots/HomFreezingPlots.jl

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
import CairoMakie as MK
22

33
import Thermodynamics as TD
4-
import CloudMicrophysics as CM
5-
import ClimaParams as CP
64

7-
const CMO = CM.Common
8-
const CMI = CM.HomIceNucleation
9-
const CMP = CM.Parameters
5+
import CloudMicrophysics.Common as CO
6+
import CloudMicrophysics.HomIceNucleation as CMI
7+
import CloudMicrophysics.Parameters as CMP
108

119
FT = Float64
12-
const tps = TD.Parameters.ThermodynamicsParameters(FT)
13-
const H2SO4_prs = CMP.H2SO4SolutionParameters(FT)
14-
const ip = CMP.IceNucleationParameters(FT)
10+
tps = TD.Parameters.ThermodynamicsParameters(FT)
11+
H2SO4_prs = CMP.H2SO4SolutionParameters(FT)
12+
ip = CMP.IceNucleationParameters(FT)
1513

1614
# Initializing
1715
T_range = range(229.0, stop = 234.5, length = 50) # air temperature
1816
x_sulph = Vector{FT}([0.03, 0.04, 0.06]) # wt% sulphuric acid in droplets
1917

2018
# Solving for Δa and J values
2119
Δa1 = [
22-
CMO.a_w_xT(H2SO4_prs, tps, x_sulph[1], T) - CMO.a_w_ice(tps, T) for
20+
CO.a_w_xT(H2SO4_prs, tps, x_sulph[1], T) - CO.a_w_ice(tps, T) for
2321
T in T_range
2422
]
2523
Δa2 = [
26-
CMO.a_w_xT(H2SO4_prs, tps, x_sulph[2], T) - CMO.a_w_ice(tps, T) for
24+
CO.a_w_xT(H2SO4_prs, tps, x_sulph[2], T) - CO.a_w_ice(tps, T) for
2725
T in T_range
2826
]
2927
Δa3 = [
30-
CMO.a_w_xT(H2SO4_prs, tps, x_sulph[3], T) - CMO.a_w_ice(tps, T) for
28+
CO.a_w_xT(H2SO4_prs, tps, x_sulph[3], T) - CO.a_w_ice(tps, T) for
3129
T in T_range
3230
]
3331

@@ -60,7 +58,7 @@ Baum_Delta_a = [0.26, 0.27, 0.28, 0.29, 0.3, 0.32, 0.33, 0.339]
6058
Baum_J = [4.25e-5, 0.306, 454.09, 2.06e5, 6.31e7, 1.8e12, 4.45e14, 1.69e17]
6159

6260
# Plotting
63-
fig = MK.Figure(resolution = (800, 500))
61+
fig = MK.Figure(size = (800, 500))
6462
ax1 = MK.Axis(
6563
fig[1, 1],
6664
ylabel = "log10(J) with J in SI units",

0 commit comments

Comments
 (0)