ECMWF Data Stores Service (DSS) API Python Client
The `ecmwf-datastores-client` is a Python library providing programmatic access to the ECMWF Data Stores Service (DSS) API. It allows users to interact with data catalogues like the Climate Data Store (CDS), Atmosphere Data Store (ADS), and Early Warning Data Store (EWDS) for metadata retrieval, synchronous or asynchronous job submission, and data download. Currently at version 0.5.1, it is in an 'Incubating' state, implying a mostly stable interface but with a readiness for incoming changes.
Warnings
- gotcha This library is 'Incubating'. While the interface is mostly stable, users should anticipate and be willing to accept breaking changes or bug fixes that may require adaptations in their code. It is not yet recommended for critical operational systems without careful version pinning.
- gotcha Users of the older `cdsapi` package are explicitly *not* requested to migrate to `ecmwf-datastores-client` at this time. `cdsapi` remains a supported and distinct client for some use cases.
- breaking Before requesting data for certain datasets, users must manually agree to the Terms of Use via the dataset's web page on the respective Data Store (e.g., CDS). API requests will fail if these terms are not accepted.
- gotcha Authentication requires an API key and a URL. These can be provided via keyword arguments to `Client()`, environment variables (`ECMWF_DATASTORES_URL`, `ECMWF_DATASTORES_KEY`), or a configuration file (e.g., `~/.ecmwfdatastoresrc`). Incorrect or missing credentials will lead to authentication failures.
- gotcha Common issues encountered with ECMWF APIs (which may also apply to `ecmwf-datastores-client`) include network-related timeouts, invalid request parameters (e.g., no data for the requested subset, ambiguous keywords), or connection problems with underlying data archives (MARS).
Install
-
pip install ecmwf-datastores-client
Imports
- Client
from ecmwf.datastores import Client
Quickstart
import os
from ecmwf.datastores import Client
# Configure API key and URL via environment variables for a runnable example
# Alternatively, pass 'url' and 'key' as keyword arguments to Client()
# or use a configuration file (~/.ecmwfdatastoresrc).
client = Client(
url=os.environ.get('ECMWF_DATASTORES_URL', 'https://data-stores.ecmwf.int/api'),
key=os.environ.get('ECMWF_DATASTORES_KEY', '')
)
# Optional: verify authentication (requires a valid key/url)
# try:
# client.check_authentication()
# print("Authentication successful!")
# except Exception as e:
# print(f"Authentication failed: {e}")
# Example: List available collections (requires authentication and access rights)
# try:
# collections = client.list_collections()
# for collection in collections:
# print(f"Collection ID: {collection.id}, Title: {collection.title}")
# except Exception as e:
# print(f"Could not list collections: {e}")