Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Have a CDS account. If you don't have an account, please self register at the CDS registration page.
  2. Option 1: use Python 2.

    Expand
    titleTest Python 2 and install pip
    1. If you want to use Python 2, then it should come with your macOS. Open a Terminal and type command 'python'. You should see something like 'Python 2.7.10 (default, Feb 22 2019, 21:17:52)'. Type 'Control + D' to quit.
    2. For Python 2, run commands below to install pip:
      1. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

      2. python get-pip.py


  3. Option 2: use Python 3. You are recommended to follow instructions here using Homebrew.

    Expand
    titleInstall Python3 through Homebrew
    1. xcode-select --install
    2. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    3. brew install python3

      Option 2: use Python 3. You are recommended to follow instructions here using Homebrew.


  4. 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 and copy the 2 line code displayed on this page. The code shows a url and your own uid:API key.
  2. Run 'touch ~/.cdsapirc' in your Terminal to create your key file and copy the two lines you see in 1 to the file.
  3. Install the CDS API client using pip:  'pip install cdsapi'. You should run this under a Terminal.
  4. Once the CDS API client is installed, it can be used to request data from the datasets listed in the CDS catalogue. 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. Examples are also shown here.

...