You can list data in the Access MARS service through ECMWF WebAPI using a Python script. This will allow any user with access to MARS to list data. The syntax is

If you do not want to use the MARS syntax with the mars script we provide, you can directly use Python. The execute function accepts both a Python dictionary or a string. To use the 'list' function, the argument must be a string starting with 'list,'. In this example we convert the request dictionary to a string with 'list':

server = ECMWFService("mars")
req = {
    "class": "od",
    "date": "20150101",
    "expver": "1",
    "levtype": "sfc",
    "param": "167.128",
    "step": "0/to/240/by/12",
    "stream": "oper",
    "time": "00",
    "type": "fc"
    }

kv=['{}={}'.format(k, v) for k, v in req.items()]
kv='list,output=cost,{}'.format(','.join(kv))

server.execute(kv,'target.txt')

Related articles

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