...
The best approach is to iterate over the Hyears you wishHindcastYears. For each Hyear HindcastYear iterate over all Hmonths HindcastMonths and for each Hmonth HindcastMonth iterate over all its HdaysHindcastDays.
Info | ||
---|---|---|
| ||
for HindcastYear in HindcastYears |
An example to request Control forecast, sfc, for HindcastYears 2010 to 2014 for 2 HindcastMonths (eg April and June)
Info | ||
---|---|---|
| ||
for HindcastYear from 2010 to 2014 |
A simple web API example, requesting Control forecast, sfc for one
...
hindcast date for model version 2014-05-01
Code Block | ||
---|---|---|
| ||
#!/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": "CHANGEMEdata.cf.sfc", "time": "00", "type": "cf", }) |
...
A web API example requesting data for several hindcastDates (iterating over several hindcastYears, hindcastMonths and hindcastDays)
- So far so good!
- Now, let's see how we can change the script above to iterate over several hindcastYears, hindcastMonths and hindcastDays efficiently
- Please note that the The objective of this example is only to 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 keywords keyword values (eg hindcastYear) according to your needs.
- Don't forget to check the availability
- to make it more "pythonic"
etc
By setting the variable "target" accordingly you can have each hindcastDate to be written on a separate file .
...