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

Compare with Current View Page History

Version 1 Next »

Using the grib_api tools

 

You will find some example data in $SCRATCH/ectrain/trx/openifs or you can use output from one of your own experiments.  Let's play !

Getting help with the tools

Running any of the GRIB API tools without options or input files will produce a UNIX 'man page' style output describing the usage.  Try:

getting help
grib_ls

Listing the contents of GRIB files

An inventory of the contents of GRIB files can be obtained with the grib_ls command.

  1. For a single file, try:

    grib_ls ICMGGepc8+000000
  2. Multiple files:

    grib_ls ICMGG*
  3. Counting the number of messages in a file

    grib_count ICMGGepc8+000000

Customising the output of grib_ls

  1. Specifying the information to display:

    grib_ls -p dataDate,dataTime,stepRange,shortName,typeOfLevel,level ICMGGepc8+000000
  2. Specifying the type of key (s: string, i: integer).  To output the centre as a string (default):

    grib_ls -p centre:s ICMGGepc8+000000

    or as an integer:

    grib_ls -p centre:i ICMGGepc8+000000
  3. Listing specific namespace information.  Try:

    grib_ls -n parameter ICMGGepc8+000000

    and

    grib_ls -n statistics ICMGGepc8+000000

    Other namespaces to try are time, vertical and geography.

  4. Order the output.  Try:

    grib_ls -B "level desc" ICMSHepc8+000000

    Compare and contrast with:

    grib_ls -B "level:i desc" ICMSHepc8+000000
  5. The where option:  IS

    grib_ls -w shortName=stl1 ICMGGepc8+000000

    IS NOT

    grib_ls -w shortName!=stl1 ICMGGepc8+000000

    OR

    grib_ls -w shortName=stl1/z ICMGGepc8+000000

    AND

    grib_ls -w shortName=q,level=10 ICMGGepc8+000000
  6. Specifying the step unit.  Compare the output from:

    grib_ls -n time ICMGGepc8+000000

    and

    grib_ls -s stepUnits=m -n time ICMGGepc8+000012

    The stepUnits can be set to s,m,h,3h,6h,12h,D,M,Y,10Y,30Y or C.  The result must be expressible as an integer (try setting stepUnits=D above). This is a temporary change for display purposes only !

     

Obtaining detailed information about a GRIB message with grib_dump

  1. To print all of the keys available for a particular GRIB message:

    grib_dump -w shortName=stl1 ICMGGepc8+000012
  2. To obtain a listing which is more like the WMO tables:

    grib_dump -O -w shortName=stl1 ICMGGepc8+000012
  3. To obtain more detail:

    grib_dump -OatH -w shortName=stl1 ICMGGepc8+000012

 

 

 

Resources and further reading

  1. The WMO FM 92 GRIB Manuals can be obtained from www.wmo.int/pages/prog/www/WMOCodes.html
  2. The ECMWF GRIB API manual is available at https://software.ecmwf.int/wiki/display/GRIB/Home
  3. ECMWF parameter database: http://old.ecmwf.int/publications/manuals/d/gribapi/param
  4. GRIB 1 keys http://old.ecmwf.int/publications/manuals/d/gribapi/fm92/grib1/
  5. GRIB 2 keys http://old.ecmwf.int/publications/manuals/d/gribapi/fm92/grib2/
  6. Edition independent keys http://old.ecmwf.int/publications/manuals/d/gribapi/keys/ 
  7. The GRIB API Tools are documented at GRIB tools
  8. Details of the GRIB API Fortran 90 interface:Fortran package grib_api
  9. Example Python scripts and Fortran 90 and C programs can be found at GRIB API examples
  10. ECMWF GRIB API training course material: GRIB API: Library and Tools



 

  • No labels