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 and daily statistics from hourly 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 hourly 2m temperature data over Europe for the year 2015.

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 some demonstration ERA5 data, this could be any url or path to an ERA5 grib or netCDF file.
remote_era5_file = earthkit_remote_test_data_file("era5_temperature_europe_2015.grib")
era5_data = ekd.from_source("url", remote_era5_file)

era5_data
# Insert your code here

Hints

Consider the following workflow:

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

  2. Use the earthkit.transforms.temporal sub-module to calculate the daily and monthly statistics

  3. Use earthkit.plots.Timeseries charts to construct the plot