Versions Compared

Key

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

...

Info
  • The objective of this example is to demonstrate how to iterate efficiently over some dates (eg '2014-10-01' and '2014-11-01')  a request  two requests  for 'perturbed forecast', 'pressure' and 'sfc' level, for TIGGE, ECMWF Center.
  • It can be used as a starting point, however you need to keep in mind that you have to adapt it to your needseg to set the keyword values according to your requirements ('param', 'levtype', 'step' etc).
  • In this way you can extend this request to download a longer period of TIGGE.

(thumbs up) Keep in mind that the most efficient way to organise your requests is per dates and times

ie select a set of dates and times and add,  the 'steps', 'origins', 'levels' and 'parameters' that you need.

(thumbs down)   It is not efficient to organise your requests per parameter, per  origin  or per step. (eg to submit a different request per parameter for a list of dates)

...

Code Block
languagepy
#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()
   
def retrieve_tigge_data():
    dates = ['2014-12-01', '2014-12-02']
    times = ['00', '12']
    for date in dates:
         for time in times:
             target = 'tigge_cf_sfc_%s_%s.grb' % (date, time)
             tigge_cf_sfc_request(date, time, target)
         

def tigge_cf_sfc_request(date, time, target):
    '''
       A TIGGE request for control forecast, sfc, for 3 Centers : ECMWF, JMA and KMA.
       You can change the keywords below to adapt it to your needs, (ie to add more parameters, or steps, or even Centers etc),
       Keep in  howevermind that if you wish to download the same data, for more than one origins, it is more efficient to request all of them in one go.
       Presumably you need to check the availability of the requested Centers.
     '''
    server.retrieve({
         'class': 'ti',
         'dataset': 'tigge',
         'date': date,
         'expver': 'prod',
         'grid': '0.5/0.5',
         'levtype': 'sfc',
         'origin': 'ecmf/rjtd/rksl',
         'param': '167/168',
         'step': '0/96/168',
         'target': target,
         'time': time,
         'type': 'cf',
       })

if __name__ == '__main__':
    retrieve_tigge_data()
                                          

...