Skip to content

1.3 Download ERA5 Temperature for Ethiopia

This lesson covers the automated retrieval of ERA5 temperature data (Mean, Min, and Max) from the Copernicus Climate Data Store (CDS). You will use a Python script to fetch hourly reanalysis, compute daily aggregates, and merge them into a single NetCDF ready for the VECTRI pipeline.

Companion notebook: 07_download_era5_temp_ethiopia.ipynb


About ERA5 Temperature

ERA5 is the fifth generation ECMWF atmospheric reanalysis of the global climate. It provides high-resolution (0.25°) estimates of various climate variables.

Aspect Detail
Dataset reanalysis-era5-single-levels
Variables 2m_temperature, minimum_2m_temp, maximum_2m_temp
Temporal coverage 1940–present
Temporal resolution Hourly (aggregated to Daily mean/min/max)
Spatial resolution 0.25° (~28 km)
Format NetCDF
Source Copernicus CDS API

For VECTRI simulations, we retrieve Mean, Minimum, and Maximum temperature to capture the thermal environment regulating malaria parasite development and mosquito biology.


What the download script does

The project script download_era5-temp.py automates the process to stay within CDS "cost limits" and avoid large file overhead:

  1. Monthly Chunking: Downloads one month at a time (hourly window) to prevent server-side request timeouts.
  2. Daily Aggregation: Computes daily statistics on-the-fly:
    • 2m_temperatureMean
    • minimum_2m_temperature_since_previous_post_processingMin
    • maximum_2m_temperature_since_previous_post_processingMax
  3. Unit Conversion: Optionally converts from Kelvin (K) to Celsius (°C).
  4. Spatial Clipping: Filters the global data to the Ethiopia bounding box during the request.
  5. Merge: Concatenates monthly files into one multi-year NetCDF.

Requirements

  1. CDS API Key: You must have a .cdsapirc file in your home directory with your UID and API Key. Get your API key here.
  2. Python Packages:
    pip install cdsapi xarray netCDF4 numpy pandas
    

Usage (command line)

From the repository root:

python docs/scripts/download_era5-temp.py --start-year YEAR --end-year YEAR --outdir OUTPUT_DIR [OPTIONS]

Arguments

Argument Meaning
--start-year First year (e.g. 1993)
--end-year Last year (e.g. 2024)
--lat-min / --lat-max Latitude bounds (e.g. 3.0 / 15.0)
--lon-min / --lon-max Longitude bounds (e.g. 33.0 / 48.0)
--outdir Folder for temporary and final files
--variables List of vars to download: t2m tmin tmax (default is all three)
--to-celsius Flag to convert output to Celsius
--merge-outfile Filename for the final merged result

Example: Ethiopia 2020 (Celsius)

python docs/scripts/download_era5-temp.py \
  --start-year 2020 --end-year 2020 \
  --lat-min 3 --lat-max 15 --lon-min 33 --lon-max 48 \
  --outdir data/raw/era5 \
  --to-celsius \
  --merge-outfile era5_temp_ethiopia_2020.nc

Output Structure

The script creates two subfolders in your --outdir: - hourly_monthly/: Raw hourly downloads (automatically deleted unless --keep-hourly is used). - daily_monthly/: Processed daily stats for each month. - era5_temp_ethiopia_2020.nc: The final merged file.


Next steps

  1. ERA5 Temperature Ingestion and QC — Preprocess and align with CHIRPS grid.
  2. Ethiopia target grid and land mask — Use the mask to finalize spatial consistency.

In Partnership With