Skip to content

NumericalEarth/CopernicusClimateDataStore.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CopernicusClimateDataStore.jl

🌍 Julia interface to the Copernicus Climate Data Store for downloading ERA5 reanalysis data

Documentation

CopernicusClimateDataStore.jl wraps the era5cli command-line tool, providing a convenient Julia interface for downloading ERA5 hourly and monthly data to NetCDF or GRIB.

Installation

using Pkg
Pkg.add("CopernicusClimateDataStore")

Before you start

You need a Copernicus Climate Data Store account:

  1. Create an account at https://cds.climate.copernicus.eu/
  2. Accept the ERA5 Terms of Use at https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels
  3. Configure your API key:
    era5cli config --key YOUR_PERSONAL_ACCESS_TOKEN

Your personal access token is on your CDS profile page.

Quick start

Download and visualize 2-metre temperature over Europe:

using CopernicusClimateDataStore
using NCDatasets
using CairoMakie

files = hourly(variables = "2m_temperature",
               startyear = 2020,
               months = 6,
               days = 21,
               hours = 12,
               area = (lat = (35, 70), lon = (-15, 40)),
               outputprefix = "europe")

# Load the data
ds = NCDataset(first(files))
λ = ds["longitude"][:]         # degrees East
φ = ds["latitude"][:]          # degrees North
T = ds["t2m"][:, :, 1] .- 273.15  # K → °C
close(ds)

# Plot
fig, ax, hm = heatmap(λ, φ, T; colormap = :thermal)
Colorbar(fig[1, 2], hm; label = "Temperature (°C)")
ax.xlabel = "λ (°E)"
ax.ylabel = "φ (°N)"
save("temperature.png", fig)

This will produce

image

Key arguments

Argument Description
variables Variable name, e.g. "2m_temperature", "total_precipitation"
startyear Year to download (required)
months Month or months (1–12)
days Day or days (1–31)
hours Hour or hours (0–23)
area Bounding box: (lat = (south, north), lon = (west, east))
format "netcdf" (default) or "grib"
outputprefix Prefix for output filename
merge Merge all data into a single file (default: false)

By default, one file is created per month. Use merge = true for a single file.

Common variables

Request name NetCDF name Description
2m_temperature t2m 2-metre temperature (K)
10m_u_component_of_wind u10 10-metre zonal wind (m/s)
10m_v_component_of_wind v10 10-metre meridional wind (m/s)
total_precipitation tp Total precipitation (m)
mean_sea_level_pressure msl Mean sea level pressure (Pa)

See the CDS ERA5 documentation for a complete list.

About

Julia wrapper for accessing ERA5 data through the Copernicus Climate Data Store

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages