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.

CHALLENGE: Plot the monthly mean of daily maximum temperature

Use all the skills and resources you have learnt today to complete the notebook below.

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

Load some data from the CDS

Download 2m temperature data from the ERA5 single levels data collection in the Climate Data Store using earthkit.data.

Please note that you require a CDS API key to access the CDS data.

Ideally they should be in your ~/.cdsapirc file, if they are not you will be prompted for the credentials when executing the following cell. For more details on setting up your CDS credentials please see the How to API page in the CDS.

dataset = "reanalysis-era5-single-levels"
request = {
    "product_type": "reanalysis",
    "variable": "2m_temperature",
    "year": "2020",
    "month": "01",
    "day": [f"{i:02d}" for i in range(1, 32)],
    "time": [f"{i:02d}:00" for i in range(24)],
    "area": [65, -10, 45, 5],  # North, West, South, East
}

# Use earthkit data to submit the above request to the CDS

data = None # ????

Get some country geometries from the gisco inventory available in the earthkit.geo.

Hint: see gisco.countries method in API reference.

countries = None # ????

Use earthkit transforms to compute the monthly mean of the daily maximum temperature.

Hint: see Daily and monthly statistics example.

daily_max = None # ????
monthly_mean_daily_max = None # ????

Plot the monthly mean as gridded data using earthkit.plots.

Hint: see Introduction to earthkit-plots

chart = None # ????

Aggregate this over your country geometries using earthkit.transforms.

Hint: see Reducing data-cubes over geometries

country_mean = None # ????

Plot the country aggregated data with choropleth method in earthkit.plots.

Hint: it will be easier if you add the data to your countries geopandas object, see Reducing data-cubes over geometries

choropleth = None # ????