Versions Compared

Key

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

...

Code Block
languagebash
module load ecmwf-toolbox
grib_ls t.grb

How many messages messages does the GRIB file containscontain? Does it match to the number of expected fields retrieved from MARS?

Expand
titleSolution

grib_ls t.grb t.grb

edition      centre       typeOfLevel  level        dataDate     stepRange    dataType     shortName    packingType  gridType     gridType
1            ecmf         isobaricInhPa  1000         20231015     0            an           t            spectral_complex  sh          
1            ecmf         isobaricInhPa  850          20231015     0            an           t            spectral_complex  sh          
1            ecmf         isobaricInhPa  700          20231015     0            an           t            spectral_complex  sh          
1            ecmf         isobaricInhPa  500          20231015     0            an           t            spectral_complex  sh          

4 of 4 messages in t.grb
4 of 4 total messages in 1 files

...

Expand
titleSolution

module load ecmwf-toolbox

grib_ls t.gg.grb  t.gg.grb

edition      centre       typeOfLevel  level        dataDate     stepRange    dataType     shortName    packingType  gridType     

1            ecmf         isobaricInhPa  1000         20231025     48           fc           t            grid_simple  reduced_gg 


grib_ls t.ll.grb t.ll.grb

edition      centre       typeOfLevel  level        dataDate     stepRange    dataType     shortName    packingType  gridType     

1            ecmf         isobaricInhPa  1000         20231025     48           fc           t            grid_simple  regular_ll 

...

With grib_dump you will see that the area in 10u_10v.grb and previously downloaded file from European area: t.ll.europe.grb are not identical.


Advanced MARS usage

Multi-target

Ensemble forecasts

1)

Retrieve the 2 metre temperature and 2 metre dew point temperature field fields of the first 10 members of a week old 12 UTC ensemble prediction (type: perturbed forecast) for 2, 3 and 4 days in advance > see in MARS Catalogue

Expand
titlesolution
retrieve,
class=od,
date=-7,
expver=1,
levtype=sfc,
number=1/to/10,
param=167.128/168.128,
step=48/to/96/by/24,
stream=enfo,
time=12,
type=pf,
target = "$SCRATCH/ensemble.[type].{shortName}.grb"

...

Expand
titlesolution
retrieve,
class=od,
date=-7,
expver=1,
levtype=sfc,
param=167.128/168.128,
step=48/to/96/by/24,
stream=enfo,
time=12,
type=cf,
target = "$SCRATCH/ensemble.[type].{shortName}.grb"


Note that this time we user used the MARS keyword "type" and the ecCodes key "shortName" in the name of the target file. Add one more parameter "param" (find in MARS catalogue link which parameters are available) to the second request and re-run it again. How many target files did the request requests create?

Expand
titleSolution

2 target files

Advanced MARS usage

Efficiency

In one of previous' requests output find a line looking like this:

...

Expand
titleSolution

number_of_tapes=11;


If you need to download this data for entire January 2020, how would you proceed:

  • Running one request for entire month (pros / cons)
  • Running 31 daily requests (pros / cons)

?

Read, Write, Compute

Retrieve U and V wind components at 10 metre from 10 day old analysis and calculate wind speed > see in MARS catalogue 

Code Block
languagebash
retrieve,
    class = od,
    expver = 1,
    stream = oper, 
    type = analysis,
    date = -10,
    time = 12,
    levtype = sfc,
    param = 165.128, # u
    grid = 1/1,
    fieldset = u
retrieve,
    param = 166.128, # v
	fieldset = v
compute,
    formula = "sqrt(u*u + v*v)",
    fieldset = speed
write,	
    fieldset = speed,
    target = "$SCRATCH/windspeed"windspeed"


Additional exercise (question from Nikolaos):

This request will read previously created GRIB file, crop the European area from global domain and save it as another GRIB file:

Code Block
languagebash
read,
    source = "windspeed",
    grid = 1/1,
    area = europe,
    target = "europe_windspeed"


To convert previously created GRIB file to netCDF using ecCodes in a terminal on the ECS or HPC:

Code Block
languagebash
>module load ecmwf-toolbox
>grib_to_netcdf -o windspeed.nc windspeed

grib_to_netcdf: Version 2.30.2
grib_to_netcdf: Processing input file 'windspeed'.
grib_to_netcdf: Found 1 GRIB field in 2 files.
grib_to_netcdf: Ignoring key(s): method, type, stream, refdate, hdate
grib_to_netcdf: Creating netCDF file 'windspeed.nc'
grib_to_netcdf: NetCDF library version: 4.9.1 of Feb  9 2023 13:54:09 $
grib_to_netcdf: Creating large (64 bit) file format.
grib_to_netcdf: Defining variable 'u10'.
grib_to_netcdf: Done.