If you do not want to use the MARS syntax with the mars script we provide, you can directly use Python. The correct syntax is:

server = ECMWFService("mars")
server.execute({ "python":"query" }, "target")

Example:

#!/usr/bin/env python
from ecmwfapi import *

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



1 Comment

  1. I had to do a 'pip install --user ecmwf-api-client' first before I could load the ecmwfapi module in Python – might be helpful for others!