Created
June 12, 2020 09:47
-
-
Save Nick3523/ef1a01e67ca7e9865658f9b7b0ea231e to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# coding: utf-8 | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
df = pd.read_csv("ts_1month_anomaly_Global_ERA5_2T_202005_v01.csv",sep=";", dtype={0: str}) | |
df['newMonth'] = df['Month'].str[-2:] | |
df['Year'] = df['Month'].str[:4] | |
tmpDf = df[df['newMonth'] == '05'] | |
print(tmpDf['global'].max()) | |
#Confirmation : je retombe bien sur le chiffre indiqué par : | |
# https://climate.copernicus.eu/surface-air-temperature-may-2020 | |
# https://www.lemonde.fr/climat/article/2020/06/05/le-mois-de-mai-le-plus-chaud-jamais-enregistre_6041867_1652612.html | |
### Le mois de mai le plus chaud depuis 1979 : | |
#En bleu les variations de températures négatives, en rouge, l'inverse | |
tmpColors = [] | |
for temperature in tmpDf['global'] : | |
if(temperature > 0) : tmpColors.append('red') | |
else : tmpColors.append('blue') | |
plt.title('Evolution de la température - pour les mois de mai - dans le monde depuis 1979', fontsize=25) | |
plt.xlabel('Année', fontsize=20) | |
plt.ylabel('Variation (+/-) de température en C° par rapport à la moyenne', fontsize=20) | |
plt.bar(tmpDf.Year, tmpDf['global'], color=tmpColors) | |
plt.gcf().set_size_inches(30, 20) | |
plt.savefig('Mai-Températre-Copernicus.png',dpi=144) | |
plt.show() | |
# ## Evolution globale des températures : | |
colors = [] | |
for temperature in df['global'] : | |
if(temperature > 0) : colors.append('red') | |
else : colors.append('blue') | |
plt.title('Evolution de la température dans le monde depuis 1979', fontsize=25) | |
plt.xlabel('Année', fontsize=20) | |
plt.ylabel('Variation (+/-) de température en C° par rapport à la moyenne', fontsize=20) | |
plt.bar(df.Month, df['global'], color=colors) | |
plt.gcf().set_size_inches(30, 20) | |
plt.xticks([]) | |
plt.savefig('Températre-Copernicus.png',dpi=144) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment