See Brief request syntax to understand each keyword.

(warning) Please note:

In this page you will find some examples in Python which is fully tested and supported.

You may wish to visit the  Web API Downloads

Python

#!/usr/bin/env python

from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()
server.retrieve({
    "class": "ti",
    "dataset": "tigge",
    "date": "2019-03-01",
    "expver": "prod",
    "grid": "2/2",
    "area": "70/-130/30/-60",
    "levtype": "sfc",
    "origin": "ecmf",
    "param": "168",
    "step": "0/6",
    "time": "00:00:00",
    "type": "fc",
    "target": "tigge-2019-03-01.grib",
})

7 Comments

  1. what is the meaning of the key word? what is the 'stream'?

     

    1. Hi Hong,

      Thanks for using our service. You can find the definition of the MARS keywords here:

      Legacy MARS keywords

      In particular, 'strem' is under "Identification keywords".

      Best regards,

      Cristian

  2. Hi,

    I would like to download multiple netcdf reports from ECMWF. I have written a python function which does this for a given date, and area, as below. This works fine in that it calls the server and gives me a link I can then click on to download the data file. However, I would like to automate this downloading (avoid having to manually click to download the file), as I will be doing this requesting across a long range of dates and areas. Is there a way to do this?

    Best,

    Ben

    def fServerRetrieve(aArea,aDate):
        server = ECMWFDataServer()
        server.retrieve({
        "class": "ei",
        "dataset": "interim",
        "date": aDate,
        "expver": "1",
        "grid": "0.75/0.75",
        "levtype": "sfc",
        "param": "167.128/228.128",
        "area" : aArea,
        "step": "3/6/9/12",
        "stream": "mnth",
        "target": "CHANGEME",
        "time": "12",
        "type": "fc",
        "format" : "netcdf"
         })

    1. Hi Ben,

      Thanks for using the Access ECMWF Public Datasets Python client. In your python program, once the server.retrieve call has finished, you should have a file called 'CHANGEME' in the directory from where you have executed the program. You do not have to click the links. Can you please check that?

      Since 'CHANGEME' does not have a meaning and it will be overwritten every time you call fServerRetrieve(aArea,aDate), you have change the name of the target file modifying the keyword:

          "target": "CHANGEME",

      to something like:

          "target": "my_file_"+aDate+".nc",

      Best regards,

      Cristian

  3. Hi,

    Thanks for your message, and suggestion - that'll work nicely. However, sorry am being a bit slow - how can I programmatically use this file to get the netcdf data? Do I need to open it as a text document?

    Best,

    Ben

  4. Hi,

    Sorry - still having trouble using the 'changeme' file. Do you know how I can use it to extract the data?

    Best,

    Ben

    1. Hi Ben,

      The request will create a netCDF file with the name that you have set in "target" keyword. You do not have to do anything else to generate the file. Once the file has been downloaded, you can use any netCDF software to extract the data. See http://www.unidata.ucar.edu/software/netcdf/ for more information.

      Best regards,

      Cristian