ECMWF Open Data Client

0.3.26 · active · verified Thu Apr 16

ecmwf-opendata is a Python package designed to simplify the download of ECMWF open data. It provides a request-based interface similar to ECMWF's MARS language for selecting meteorological fields. The library is actively maintained (current version 0.3.26) and receives frequent updates, with new releases typically addressing data source changes, bug fixes, and supporting new data streams. It allows users to retrieve data from ECMWF's direct servers as well as cloud replicas on AWS, Azure, and Google Cloud Platform.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to instantiate the Client and use its `retrieve` method to download meteorological data. It highlights the importance of specifying a data `source` for optimal performance and reliability, especially given potential connection limits to the ECMWF portal. The parameters for `retrieve` follow the MARS request language to define the desired dataset.

from ecmwf.opendata import Client

# Initialize the client, specifying a source for reliability (e.g., 'aws', 'azure', 'google' or 'ecmwf')
# Using a cloud source is often recommended due to connection limits on ECMWF's direct portal.
client = Client(source="aws")

# Example: Download the latest available 10-day forecast for mean sea level pressure (msl)
# into a local file named 'data.grib2'.
# Parameters like 'step', 'type', 'param' are based on MARS language.
try:
    client.retrieve(
        step=240,       # Forecast step in hours (e.g., 240 for 10 days)
        type="fc",      # Type of data (e.g., 'fc' for forecast)
        param="msl",    # Parameter to retrieve (e.g., 'msl' for mean sea level pressure)
        target="data.grib2", # Output file name
    )
    print("Data downloaded successfully to data.grib2")
except Exception as e:
    print(f"An error occurred during data retrieval: {e}")

view raw JSON →