Versions Compared

Key

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

...

Use MARS list to find out the size

 Using the MARS catalogue and the "View MARS request" functionality you can create a list request of all the data you want which would tell you the size and distribution of the raw data in the archive. Note the LIST verb and the OUTPUT = COST keyword.

No Format
LIST,
    OUTPUT     = COST,
    CLASS      = OD,
    TYPE       = FC,
    STREAM     = OPER,
    EXPVER     = 0001,
    LEVTYPE    = ML,
    LEVELIST   = 127/128/129/130/131/132/133/134/135/136/137,
    PARAM      = 130/131/132,
    DATE       = 20170401/20170402/20170403/20170404/20170405/20170406/20170407/20170408/20170409/20170410/20170411/20170412/20170413/20170414/20170415/20170416/20170417/20170418/20170419/20170420/20170421/20170422/20170423/20170424/20170425/20170426/20170427/20170428/20170429/20170430,
    TIME       = 0000/1200,
    STEP       = 0/to/90/by/1,
    TARGET     = list.txt

...

Using the MARS catalogue we browse the data we want to get until we get to the final stage which gives us a selection and several options: http://apps.ecmwf.int/mars-catalogue/?class=od&stream=oper&expver=1&type=fc&year=2017&month=apr&levtype=ml&date=2017-04-01&time=00:00:00

Image Added

For this particular case we can choose for 1 day, 1 time, different "Parameter", "Level" and "Step". This means that all the fields you can choose in this page are in the same tape file. Therefore users should get as much data as possible from this page.

...

From the top to the bottom we have to start iterating from the inner loop to the outer loop "Timetime", "date", ...

This is an example BASH script to loop 1 time/ 1 day in one go for one month

Code Block
languagebash
#!/bin/bash

#this example will filter the area of Europe (N/W/S/E) and interpolate the final fields to a lat/lon 0.5/0.5 degrees
AREA="73.5/-27/33/45"
GRID="0.5/0.5"
PARAMS="130/131/132"
LEVELIST="127/128/129/130/131/132/133/134/135/136/137"
TIMES="0000 1200"
YEAR="2017"
MONTH="04"

#date loop
for y in ${YEAR}; do

  for m in ${MONTH}; do
    #get the number of days for this particular month/year
    days_per_month=$(cal ${m} ${y} | awk 'NF {DAYS = $NF}; END {print DAYS}')

    for my_date in $(seq -w 1 ${days_per_month}); do
      my_date=${YEAR}${MONTH}${my_date}

      #time lop
      for my_time in ${TIMES}; do
        cat << EOF > my_request_${my_date}_${my_time}.mars
REQUEST,
    CLASS      = OD,
    TYPE       = FC,
    STREAM     = OPER,
    EXPVER     = 0001,
    LEVTYPE    = ML,
    GRID       = ${GRID},
    AREA       = ${AREA},
    LEVELIST   = ${LEVELIST},
    PARAM      = ${PARAMS},
    DATE       = ${my_date},
    TIME       = ${my_time},
    STEP       = 0/to/90/by/1,
    TARGET     = oper_ml_${my_date}_${my_time}.grib
EOF
      mars my_request_${my_date}_${my_time}.mars
      if [ $? -eq 0 ]; then
        rm -f my_request_${my_date}_${my_time}.mars
      fi
      done
    done
  done
done      

...