You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 75 Next »

 

What is the objective of this page?

The objective:

To help users to improve S2S CMA MARS requests performance via the WebAPI.

(lightbulb) A good understanding of the MARS efficiency issues is essential especially for users that are interested in downloading large amounts of data.

How is the S2S data organised in MARS?

In general it is organised, as a huge tree, with the indentation below, showing different levels down that tree:

  • centre (CMA, ECMWF, NCEP, JMA, ...)
    • realtime or reforecast
      •  type of data (control forecast or perturbed forecast)
        • type of level (single level or pressure level or potential  temperature)
          • model version date (2014-05-01 or ...)
            • hindcast dates (2014-01-01 or 2014-01-02 or 2014-01-03, ...)
              •  time-steps
                • members (for perturbed forecast)
                  • levels (for pl or pt)
                    • parameters


(lightbulb) The idea is to request as much data as possible from the same tape file, all time-steps, all members, all parameters for a type of level, a type, a hindcast date

What would be the natural way to group requests?

Following the previous paragraph,  the natural way to group requests would be:
all parameters, all levels, all members, all time-steps for 1 hindcast date.

(warning) Note the following:

  1. 'all' means 'all' that the user wants. It doesn't have to be all parameters.
  2. If a user is interested only on z500,  he may request more hindcast dates in one go, since the overall request will not be so big.

Best practices:

To loop over several hindcastDates for a CMA request

The main idea in brief:

for hindcastDate in hindcastDateList (eg, 2010-03-01 to 2010-03-31)
     S2S-request(hindcastDate)

(lightbulb) You may wish to have a look on some CMA re-forecast examples or to visit the ECMWF Web API Home

To get all hindcastDates for several hindcastYears for a CMA request

The main idea in brief:

(lightbulb) The best approach is to iterate over the hindcastYears. For each hindcastYear iterate over all the available hindcastMonths and for each hindcastMonth iterate over all the available hindcastDays.

(warning) At this point you may wish to check CMA availability and to view a CMA request

The main idea in brief:

for hindcastYear in hindcastYears
for hindcastMonth in hindcastMonths
for hindcastDay in hindcastDays
hindcastDate = HindcastYear-hindcastMonth-hindcastDay
S2S-request(hindcastDate)

Web-API examples:

A CMA reforecast request for one hindcastDate

The request below is for control forecast, sfc and for model version 2014-05-01

#!/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",
})

A CMA reforecast request for several hindcastDates (iterate efficiently)

  • The objective of this example is to demonstrate how to make a request efficient by iterating properly over several hindcastYears, hindcastMonths and hindcastDays
  • It can be used as a starting point however you need to adapt it to your needs eg to set the keyword values (eg hindcastYear)  according to your needs,
  • In this way you can extend this request to download the whole S2S CMA reforecast but don't forget to check CMA availability (warning)

(warning) Please note: use the variable "target"  to write each hindcastDate on a separate file .

#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()
def retrieve_data(hindcastDate):
    target = "target_s2s_%s.grb" % hindcastDate
    server.retrieve({
       "class": "s2",
       "dataset": "s2s",
       "date": "2014-05-01",
       "expver": "prod",
       "hdate": hindcastDate,
       "levtype": "sfc",
       "origin": "babj",
       "param": "165",
       "step": "0",
       "stream": "enfh",
       "target": target,
       "time": "00",
       "type": "cf",
})

for hindcastYear in ["2012", "2013"]:
    for hindcastMonth in ["08", "09"]:
        for hindcastDay in ["01", "02"]:
            hindcastDate = hindcastYear+hindcastMonth+hindcastDay
            retrieve_data(hindcastDate)


 



  • No labels