You only need to go through this procedure once, before you can use the CDS API on macOS to programmatically download data from either the Climate Data Store (CDS) or the Atmosphere Data Store (ADS).

Prerequisites

  1. You need to have a CDS or ADS account. If you don't have an account, please self register at the CDS registration page or the ADS registration, whichever is appropriate.
  2. You need Python
  3. Optional: you are recommended to set up a virtual environment.

Python 3 comes up with this feature. For Python 2, you may want to use Virtualenv. This is out of the scope of this knowledge base article.

Step-by-step guide

  1. Login to CDS (or Login to ADS)
  2. Copy a 2 line code, which shows a url and your own uid:API key details as follows:
    1. For CDS users, Go to this page and copy the 2 line code displayed in the black box in the "Install the CDS API key" section.
    2. For ADS users, Go to this page and copy the 2 line code displayed in the black box in the "Install the CDS API key" section.
  3. Create your key file in your home directory in your Terminal window as follows:

    touch ~/.cdsapirc


  4. Edit your key file and paste the two lines you copied in Step 2 above to your .cdsapirc key file.
  5. Install the CDS API client using pip, by running the following command in your Terminal window:

    pip install cdsapi


  6. Once the CDS API client is installed, it can be used to request data from the datasets listed in the CDS and ADS catalogues. It is necessary to agree to the Terms of Use of every datasets that you intend to download. Attached to each dataset download form, the 'Show API request' button displays the python code to be used.


If you are getting connection issues, we recommend that in the first instance you check your proxy settings with your local IT team.


This document has been produced in the context of the Copernicus Climate Change Service (C3S).

The activities leading to these results have been contracted by the European Centre for Medium-Range Weather Forecasts, operator of C3S on behalf of the European Union (Delegation Agreement signed on 11/11/2014 and Contribution Agreement signed on 22/07/2021). All information in this document is provided "as is" and no guarantee or warranty is given that the information is fit for any particular purpose.

The users thereof use the information at their sole risk and liability. For the avoidance of all doubt , the European Commission and the European Centre for Medium - Range Weather Forecasts have no liability in respect of this document, which is merely representing the author's view.

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.



Related issues