Skip to content

Commit 633b8c0

Browse files
committed
Version of code as of submission of revised JAMES paper.
1 parent b289705 commit 633b8c0

File tree

4 files changed

+492
-56
lines changed

4 files changed

+492
-56
lines changed

plot_dynamics_attribution.py

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,37 @@
6262
REF_CASE = E3SMCaseOutput("timestep_presaer_ctrl", "CTRLPA", MONTHLY_FILE_LOC, START_MONTH, END_MONTH)
6363
TEST_CASES = [
6464
]
65+
STYLES = {
66+
"CLUBBMICRO10PA": ('indigo', '-'),
67+
"ALL10PA": ('dimgrey', '-'),
68+
"ZM10PA": ('g', '-'),
69+
"CLUBBMICRO10ZM10PA": ('saddlebrown', '-'),
70+
"CLD10PA": ('slateblue', '-'),
71+
"ALL10LTPA": ('dimgrey', '-.'),
72+
"ZM10LTPA": ('g', '-.'),
73+
"CLUBBMICRO10ZM10LTPA": ('saddlebrown', '-.'),
74+
"CLD10LTPA": ('slateblue', '-.'),
75+
"CLD10LT2PA": ('slateblue', ':'),
76+
}
6577
else:
6678
REF_CASE = E3SMCaseOutput("timestep_ctrl", "CTRL", MONTHLY_FILE_LOC, START_MONTH, END_MONTH)
6779
TEST_CASES = [
6880
E3SMCaseOutput("timestep_all_10s", "ALL10", MONTHLY_FILE_LOC, START_MONTH, END_MONTH),
6981
]
82+
STYLES = {
83+
"DYN10": ('y', '-'),
84+
"CLUBB10": ('b', '-'),
85+
"MICRO10": ('r', '-'),
86+
"CLUBB10MICRO10": ('maroon', '-'),
87+
"CLUBBMICROSTR": ('m', '-'),
88+
"CLUBBMICROSTR60": ('m', '--'),
89+
"CLUBBMICRO60": ('indigo', '--'),
90+
"CLUBBMICRO10": ('indigo', '-'),
91+
"ALL10": ('r', '-'),
92+
"ALL60": ('dimgrey', '--'),
93+
"ALL300": ('dimgrey', ':'),
94+
"ALLRAD10": ('orange', '-'),
95+
}
7096

7197
case_num = len(TEST_CASES)
7298

@@ -208,9 +234,13 @@ def plot_dyn_attr(names, units, scales, log_plot_names):
208234
test_total_dists[i][name] += test_var_dists[i][name]*scales[name] / nmonths
209235

210236
omegas = 864.*np.linspace(omega_span[0] + 0.5*bin_size, omega_span[1] - 0.5*bin_size, nbins)
211-
plt.plot(omegas, ref_total_pdf / bin_size, label=REF_CASE.short_name)
237+
plt.semilogy(omegas, ref_total_pdf / bin_size, label=REF_CASE.short_name,
238+
color='k')
212239
for i in range(case_num):
213-
plt.plot(omegas, test_total_pdfs[i] / bin_size, label=TEST_CASES[i].short_name)
240+
plt.semilogy(omegas, test_total_pdfs[i] / bin_size,
241+
label=TEST_CASES[i].short_name,
242+
color=STYLES[TEST_CASES[i].short_name][0],
243+
linestyle=STYLES[TEST_CASES[i].short_name][1])
214244
plt.axis('tight')
215245
plt.xlabel(r'$\omega_{500}$')
216246
plt.ylabel(r'$p(\omega_{500})$')
@@ -231,12 +261,14 @@ def plot_dyn_attr(names, units, scales, log_plot_names):
231261
else:
232262
plot_var = plt.plot
233263
ref_plot_var = get_2D(ref_total_dists[name]) * ref_total_pdf
234-
plot_var(omegas, ref_plot_var, label=REF_CASE.short_name)
264+
plot_var(omegas, ref_plot_var, label=REF_CASE.short_name, color='k')
235265
for i in range(case_num):
236266
test_plot_var = get_2D(test_total_dists[i][name]) * test_total_pdfs[i]
237267
plot_var(omegas,
238268
test_plot_var,
239-
label=TEST_CASES[i].short_name)
269+
label=TEST_CASES[i].short_name,
270+
color=STYLES[TEST_CASES[i].short_name][0],
271+
linestyle=STYLES[TEST_CASES[i].short_name][1])
240272
print(name, " for case ", TEST_CASES[i].short_name, " has total diff ",
241273
(test_plot_var - ref_plot_var).sum(),
242274
file=log_file, flush=True)
@@ -360,7 +392,8 @@ def plot_dyn_attr(names, units, scales, log_plot_names):
360392
'TMQ': r'$kg/m^2$',
361393
'T': r'$K$',
362394
}
363-
names = list(units.keys())
395+
#names = list(units.keys())
396+
names = ['PRECC', 'PRECL', 'PRECT', 'OMEGA500']
364397
scales = dict()
365398
for name in names:
366399
scales[name] = 1.

0 commit comments

Comments
 (0)