Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Calculate and plot monthly climatologies of ERA5 data

Using only the packages imported and data loaded in the first code block, produce a figure similar to the one show below.

figure1

All the information and code required to complete this task can be found in the earthkit-transforms Documentation pages.

The following code cell imports the required earthkit modules and uses earthkit-data to download the sample data. The data is a grib file containing 6-hourly 2m temperature data over Europe for the years 2015-2018. It is at a coarse spatial resolution of 3˚x3˚ and is intended for demonstration purposes only.

from earthkit.data.utils.testing import earthkit_remote_test_data_file

from earthkit import data as ekd
from earthkit import plots as ekp
from earthkit import transforms as ekt

# Get the demonstration ERA5 data
remote_era5_file = earthkit_remote_test_data_file("era5-Europe-sfc-2m-temperature-3deg-2015-2017.grib")
era5_data = ekd.from_source("url", remote_era5_file)
# Insert your code here

Hints

Consider the following workflow:

  1. Optional, convert data to xarray to have more control on the dimensionality of the results.

  2. Use the earthkit.transforms.climatology sub-module to calculate the monthly climatology.

  3. Use the earthkit.transforms.temporal sub-module to calculate the daily mean.

  4. Use earthkit.plots.Timeseries to create the plot

    • see the repeat_years argument available in the plotting methods