You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 KiB
64 KiB
Seasonal variation of air temperatures averaged over different latitudes¶
The source code of Figures 1.4 and 2.3
Importing libraries¶
In [1]:
import matplotlib.pyplot as plt
import numpy as np
In [2]:
# montly averaged temperatures at 2 m (T2m) for each 1° wide latitude strip;
# T2m values are calculated with the WRF model, the shape is (180, 12)
wrf_mon_T2 = np.load("./data/WRF/WRF_T2_LATxMON.npy")
In [3]:
# area factors for different latitudes
area_factor = (
np.cos(np.arange(180) * np.pi / 180)
- np.cos(np.arange(1, 181) * np.pi / 180)
) / 2
In [4]:
month_name = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]
In [5]:
# boundary latitudes for the plot
lat = [20, 30, 40, 50]
Figure 1.4/2.3¶
Seasonal variation of air temperatures averaged over different latitudes
In [6]:
fig = plt.figure(figsize=(10, 14), constrained_layout=False)
ax = [None for _ in range(4)]
for n in range(4):
ax[n] = fig.add_subplot(4, 4, (2 * n + 1, 2 * n + 2))
low = [23, 22, 20, 18]
high = [27, 26, 24, 22]
step = [1] * 4
coeff = [1] * 4
caption = [f"WRF, 1980–2020, {lt}° S–{lt}° N" for lt in lat]
# thin spaces (" ") are used between ‘°’ signs and letters
col = ["firebrick"] * 4
for n in range(4):
for axis in ["top", "bottom", "left", "right"]:
ax[n].spines[axis].set_linewidth(0.5)
ax[n].tick_params(length=6, width=0.5, axis="y")
ax[n].tick_params(length=0, width=0.5, axis="x")
ax[n].grid(color="0.", linewidth=0.5, axis="y")
ax[n].set_xlim((-0.5, 11.5))
ax[n].set_xticks(np.arange(12))
ax[n].set_xticklabels(month_name, fontsize="large", va="top")
ax[n].set_ylim((low[n], high[n]))
ax[n].set_yticks(np.arange(low[n], high[n] + step[n] / 2, step[n]))
ax[n].set_yticklabels((np.arange(low[n], high[n] + step[n] / 2,
step[n]) / coeff[n]).astype(int),
fontsize="large")
ax[n].set_ylabel("Mean surface\nair temperature, °C",
fontsize="large")
ax[n].set_title(caption[n], fontsize="large")
fig.align_ylabels([ax[0], ax[2]])
fig.align_ylabels([ax[1], ax[3]])
for n in range(4):
# averaging temperature values taking into account
# variable areas of 1° wide latitude strips
T_values = np.sum(
wrf_mon_T2[90 - lat[n] : 90 + lat[n]]
* area_factor[90 - lat[n] : 90 + lat[n], np.newaxis],
axis=0,
) / np.sum(area_factor[90 - lat[n] : 90 + lat[n]])
ax[n].bar(np.arange(12), T_values, width=0.8, color=col[n])
for n in range(4):
ax[n].text(-0.25, 1.05, chr(ord("a") + n),
fontsize="x-large",
fontweight="semibold", ha="left", va="bottom",
transform=ax[n].transAxes)
fig.subplots_adjust(hspace=0.3, wspace=1.0)
fig.savefig("figures/t2.eps", bbox_inches="tight")
In [ ]: