The `cdsapi` library provides a Python interface to access the Copernicus Climate Change Service (C3S) Climate Data Store (CDS) API. It allows users to programmatically search, retrieve, and download vast amounts of climate data. Currently at version 0.7.7, it receives active maintenance and updates, with minor releases typically every few weeks to months, often addressing compatibility with the evolving CDS backend.
pip install cdsapiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `cdsapi.Client` and make a basic data retrieval request for ERA5 reanalysis data. Ensure your CDS API credentials are set up either in `~/.cdsapirc` or via environment variables (`CDSAPI_URL`, `CDSAPI_KEY`) before running, as the example uses placeholders.
Create `~/.cdsapirc` with `url: <CDSAPI_URL>` and `key: <YOUR_UID>:<YOUR_API_KEY>`, or set the corresponding environment variables. Register at [cds.climate.copernicus.eu](https://cds.climate.copernicus.eu/user/register) to get your UID and API Key.
Always ensure `cads-api-client` is updated to the version required by your `cdsapi` version. Use `pip install --upgrade cdsapi cads-api-client`.
Consult the CDS website for the specific dataset's documentation and available parameters. Use the web interface to build a request, then translate the generated API request into Python code.
For large datasets, consider requesting smaller chunks (e.g., by year/month) or using asynchronous download mechanisms if available. Implement robust error handling and retry logic around `retrieve()` calls.