CopernicusClimateDataStore.jl

Julia wrapper around the Copernicus Climate Data Store (CDS) for downloading ERA5 reanalysis data.

This package wraps the era5cli Python command-line tool, providing a convenient Julia interface for downloading ERA5 and ERA5-Land data.

Installation

using Pkg
Pkg.add(url="https://github.com/NumericalEarth/CopernicusClimateDataStore.jl")

CDS Account Setup

Before downloading data, you must:

  1. Create a CDS account at https://cds.climate.copernicus.eu/
  2. Accept the Terms of Use for the ERA5 dataset at https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels?tab=download#manage-licences
  3. Configure your API key by running:
    era5cli config --key YOUR_PERSONAL_ACCESS_TOKEN

Your personal access token can be found on your CDS profile page after logging in.

Quick Start

Download ERA5 data

using CopernicusClimateDataStore

# Download 2m temperature for a single snapshot
files = hourly(
    variables = "2m_temperature",
    startyear = 2020,
    months = 1,
    days = 1,
    hours = 12,
    area = (lat = (35, 60), lon = (-10, 25)),
    format = "netcdf",
    outputprefix = "europe"
)

# files contains the path(s) to the downloaded NetCDF file(s)
filename = first(files)

Load and plot

using NCDatasets
using CairoMakie

# Open the NetCDF file
ds = NCDataset(filename)

lon = ds["longitude"][:]
lat = ds["latitude"][:]
temp_K = ds["t2m"][:, :, 1]
temp_C = temp_K .- 273.15

close(ds)

# Plot
fig = Figure(size = (800, 600))
ax = Axis(fig[1, 1], xlabel = "Longitude", ylabel = "Latitude")
hm = heatmap!(ax, lon, lat, temp_C', colormap = :thermal)
Colorbar(fig[1, 2], hm, label = "Temperature (°C)")
fig

Key Arguments

ArgumentDescription
variablesVariable name(s), e.g. "2m_temperature"
startyearYear to download
monthsMonth(s), 1–12
daysDay(s), 1–31
hoursHour(s), 0–23
areaBounding box: (lat = (south, north), lon = (west, east))
format"netcdf" or "grib"
outputprefixPrefix for output filename
dryrunIf true, print command without downloading
splitmonthsSplit output by month (default: true)
mergeMerge all output into a single file (default: false)

Note: By default, era5cli creates one file per month. If you request multiple months, you will receive multiple files. Use merge=true to combine all data into a single file.

Common Variables

Request nameNetCDF nameDescription
2m_temperaturet2m2 metre temperature (K)
10m_u_component_of_windu1010 metre U wind (m/s)
10m_v_component_of_windv1010 metre V wind (m/s)
total_precipitationtpTotal precipitation (m)
mean_sea_level_pressuremslMean sea level pressure (Pa)