Skip to main content

ecmwf-api-client

PyPI version Python versions Build License

Python client for the ECMWF Web API. Two entry points:

  • ECMWFDataServer — retrieve IFS research experiments.
  • ECMWFService — access MARS, ECMWF's Meteorological Archival and Retrieval System, for authorized users.

What this client is for

  • IFS research experiments — available anonymously, or with registered access for a better quality of service.
  • MARS archive access — for authorized users; see Access MARS for who can access it and how.

Looking for public datasets?

The ECMWF Public Datasets Service (TIGGE, S2S, ERA-Interim, and others) has been decommissioned. See the decommissioning notice for where each dataset moved — in short: TIGGE and S2S to the ECMWF Data Store (ECDS), reanalyses to the Climate Data Store (CDS), and real-time open forecast data is available via ecmwf-opendata.

Installation

$ pip install ecmwf-api-client

or with conda:

$ conda install -c conda-forge ecmwf-api-client

Configure

Anonymous access (default)

No configuration needed. Anonymous access works only for the IFS research experiments, with a lower quality of service. For everything else, and for a better quality of service, use registered access.

Registered access (recommended)

  • Register with ECMWF at https://www.ecmwf.int.

  • Retrieve your API key at https://api.ecmwf.int/v1/key/ (see Install ECMWF API Key for details, including key expiry and renewal).

  • Save the key to $HOME/.ecmwfapirc (Unix/Linux/macOS) or C:\Users\<USERNAME>\.ecmwfapirc (Windows):

    {
        "url"   : "https://api.ecmwf.int/v1",
        "key"   : "XXXXXXXXXXXXXXXXXXXXXX",
        "email" : "john.smith@example.com"
    }
    
  • Alternatively, point the environment variable ECMWF_API_RC_FILE to a file of your choice (takes priority over .ecmwfapirc).

  • Or set ECMWF_API_KEY, ECMWF_API_URL, ECMWF_API_EMAIL directly in the environment (takes priority over ECMWF_API_RC_FILE).

  • Or pass the values directly in code: ECMWFDataServer(url=..., key=..., email=...) or ECMWFService("mars", url=..., key=..., email=...).

Retrieving IFS research experiments

Use ECMWFDataServer:

from ecmwfapi import ECMWFDataServer

server = ECMWFDataServer()
server.retrieve({
    # ... request parameters ...
})

Don't write the request by hand. Open the experiment's page (for example https://apps.ecmwf.int/ifs-experiments/rd/gkzp/), select what you need, and the site generates the exact request to paste into retrieve({...}).

Accessing MARS

For MARS access, follow Access MARS. The recommended way is the mars command wrapper script provided there, which runs MARS requests from a file. The wrapper is built on this package's ECMWFService class.

Retrieving efficiently

Before submitting requests, it is recommended to read Retrieval efficiency — it explains how to check the cost of requests, how to structure requests around tapes, and the request limits. The Web API FAQ covers monitoring requests and common errors.

Logging

By default, log messages are printed to stdout. To use your own logging:

import logging
from ecmwfapi import ECMWFDataServer

logging.basicConfig(level=logging.INFO)

def my_logging_function(msg):
    logging.info(msg)

server = ECMWFDataServer(log=my_logging_function)

License

Copyright 2019 European Centre for Medium-Range Weather Forecasts (ECMWF) Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. In applying this licence, ECMWF does not waive the privileges and immunities granted to it by virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.

Metadata

Release files for ecmwf-api-client 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ecmwf-api-client 1.7.0
File Size Uploaded Provenance Actions
ecmwf_api_client-1.7.0.tar.gz 13.1 kB Without provenance Details for ecmwf_api_client-1.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ecmwf-api-client 1.7.0
File Interpreter ABI Platform Actions
ecmwf_api_client-1.7.0-py3-none-any.whl Python 3 none any Details for ecmwf_api_client-1.7.0-py3-none-any.whl

Total release size: 26.6 kB

Release files / ecmwf_api_client-1.7.0.tar.gz

Download URL ecmwf_api_client-1.7.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1971a047c01cc50cfc893f13fdfa710cf56fb872f1c04685b13c6f1d18431164
BLAKE2b-256 checksum
How to use checksums
49a623179f1fd6226c42c3c7103a265ade7c020e66f45f6068ec4bf66539068a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.18

Release files / ecmwf_api_client-1.7.0-py3-none-any.whl

Download URL ecmwf_api_client-1.7.0-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3648fa1f4cb0d56274e388acaccf5500da260f12126566e0fc0a9538e46f12d1
BLAKE2b-256 checksum
How to use checksums
52c32d9bfd9cf6a0866dedd74936633761606c005d4aeee17be2b04764e3f1da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.18

Security for ecmwf-api-client 1.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page