Tech Blog 6: Using Python and Matplotlib for plotting ERA5 data
A quick/dirty tech blog today, getting to know some of Matplotlib’s extra features for generating some attractive plots!
Using yearly ERA5 temperature data from 1979 to present obtained from the Copernicus Climate Data Store, the data was masked by country using shapefiles from Natural Earth and then an average was taken for the area (see previous blogs on area averaging for information on how to do this).
This was plotted to view whether there was any notable trends. As expected, all countries appear to be increasing in temperature over time. When the plots are smoothed using a gaussian_filter, the rise in temperature shows a clear trend (highlighted with dotted plot).
The plotting theme is achieved by declaring the matplotlib code inside plt.style.context(‘Solarize_Light2’)
Then each line is given a hex value to precisely define the color of the plot line, this value is matched in the mpatches
First load python packages and csv file: