Created
October 4, 2022 12:11
-
-
Save hbshrestha/22704e1c554cb09565113ae8c3f28508 to your computer and use it in GitHub Desktop.
code to get the global surface temperature anomaly using NASA GISSTEMP v4 data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig, ax = plt.subplots() | |
df["Annual Mean"].plot(ax = ax, c = "black", marker = "s") | |
df["Lowess Smoothing"].plot(ax = ax, c = "red") | |
x = df.index.tolist() | |
y = df["Annual Mean"].tolist() | |
# Define the 95% confidence interval | |
ci = np.mean(y) + 1.96 * np.std(y) / np.sqrt(len(y)) | |
plt.fill_between(x, y-ci, y+ci, | |
color = "gray", | |
alpha = 0.25, | |
label = "LSAT+SST Uncertainty") | |
ax.axhline(y = 0, linestyle = "--", color = "black") | |
plt.legend(loc = "upper left") | |
plt.ylabel("Temperature anomaly w.r.t. 1951-80 mean (°C)") | |
plt.title("Global surface air temperature change estimates based on land and ocean data") | |
plt.savefig("../output/global annual mean surface air temperature change.jpeg", | |
dpi = 300) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment