Versions Compared

Key

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

...

(lightbulb) If the request is "small" you may request more hindcastDates in one go. See the example below.
Code Block
languagepy
#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
modelVersionDate = "2014-05-01"
hindcastDate = "2014-04-01"  # The selected hindcast date
server = ECMWFDataServer()
server.retrieve({
    "class": "s2",
    "dataset": "s2s",
    "date": ModelVersionDate,
    "expver": "prod",
    "hdate": hindcastDate, 
    "levtype": "sfc",
    "origin": "babj",
    "param": "165",
    "step": "0",
    "stream": "enfh",
    "target": "data.cf.sfc",
    "time": "00",
    "type": "cf",
})
Info

 

A web API example requesting data for several hindcastDates (iterating over several hindcastYears, hindcastMonths and hindcastDays)

Info
  • The objective of this example is to demonstrate how to make a MARS request efficient by iterating properly. 
  • It can be used as a starting point however you need to adapt it to your needseg:
    • to set the keyword values (eg hindcastYear)  according to your needs. 
    • don't forget to check CMA availability (warning)to make it more "pythonic" (wink)

(grey lightbulb) By setting the variable "target" accordingly you can have each hindcastDate to be written on a separate file .

...