Difference between revisions of "How to read GRIB files!"

From mn/geo/geoit
Jump to: navigation, search
m
m
Line 9: Line 9:
 
'''GRI'''dded '''B'''inary is a compressed format for meterological data used since 1985.
 
'''GRI'''dded '''B'''inary is a compressed format for meterological data used since 1985.
  
Requires software for encoding and decoding
+
Requires software for encoding and decoding.
 
 
  
  
Line 17: Line 16:
  
 
Currently used for ECMWF operational ''surface'' and ''pressure level'' data.
 
Currently used for ECMWF operational ''surface'' and ''pressure level'' data.
 +
 +
GRIB1 data is stored in 5 ''sections'' where section 4 includes the compressed data and the other sections are data specifications.
 +
 +
One GRIB1 file may include many messages (blocks of sections).
 +
  
  
Line 33: Line 37:
 
GRIB2 also allows more flexibility and is more complex than GRIB1.  
 
GRIB2 also allows more flexibility and is more complex than GRIB1.  
  
For example.
+
For example higher precision of variables.
  
 
  GRIB1: Lon/lat is in milli-degree
 
  GRIB1: Lon/lat is in milli-degree
 
  GRIB2: Lon/lat is in micro-degree
 
  GRIB2: Lon/lat is in micro-degree
 +
 +
 +
GRIB2 data are stored in 8 ''sections'' where section 7 includes the compressed data and the other sections are data specifications.
 +
Thus, the structure of GRIB1 and GRIB2 messages is different, the order of the sections are different and there are additional sections for GRIB2.
  
  
Line 44: Line 52:
 
To decode GRIB data there are software available from ECMWF.
 
To decode GRIB data there are software available from ECMWF.
  
This software is is the '''GRIB_API (Application Programming Interface)''' library.
+
This software is the '''GRIB_API (Application Programming Interface)''' library.
 +
 
 +
This software hides the binary layer of the message and uses a key/value approach to access the information in a GRIB message.
 +
 
 +
GRIB1 and GRIB2 uses the '''same''' function call.
 +
 
 +
'''Many keys to identify a parameter are edition independent, use these where possible!'''
 +
 
 +
 
 +
'''GRIB_API''' can be used either through
 +
Command line tools
 +
Fortran90/C/Python interfaces
 +
 
 +
 
 +
== COMMAND-LINE GRIB TOOLS==
 +
 
 +
 
 +
The general use of the grib tools uses the following principle
 +
''' grib_tool <options> grib_file1 grib_file2... [output file]'''
 +
 
 +
 
 +
''grib_ls''      lists the messages in a GRIB file
 +
 
 +
''grib_dump''    provides a more detailed view and listing of the file
 +
 
 +
''grib_get''
 +
 +
''grib_get_data''
 +
 
 +
''grib_compare''
 +
 
 +
''grib_count''
  
This software hides the binary layer and uses a key/value approach to access the information.
+
''grib_copy''
  
GRIB1 and GRIB2 uses the same function call.
+
''grib_set''
  
There are both command line tools, and Fortran90/C/Python interfaces.
+
''grib_filter''

Revision as of 13:08, 13 March 2013

Back to ECMWF overview[1]


Updated by nik: 13 March 2013


GRIB

GRIdded Binary is a compressed format for meterological data used since 1985.

Requires software for encoding and decoding.


GRIB1

Currently used for ECMWF operational surface and pressure level data.

GRIB1 data is stored in 5 sections where section 4 includes the compressed data and the other sections are data specifications.

One GRIB1 file may include many messages (blocks of sections).



GRIB2

was introduced for ECMWF operational model level data on 18 May 2011.

Migration from GRIB1 to GRIB2 was necessary because GRIB1 data could only hold 126 model levels.

Number of model levels in the high resolution forecast will be increased from 91 to 137 in June 2013.

Pressure levels will still have GRIB1 but eventually this will also be changed.

"Old" model data will still have GRIB1 format in the archive.

GRIB2 also allows more flexibility and is more complex than GRIB1.

For example higher precision of variables.

GRIB1: Lon/lat is in milli-degree
GRIB2: Lon/lat is in micro-degree


GRIB2 data are stored in 8 sections where section 7 includes the compressed data and the other sections are data specifications. Thus, the structure of GRIB1 and GRIB2 messages is different, the order of the sections are different and there are additional sections for GRIB2.


GRIB-decoding

To decode GRIB data there are software available from ECMWF.

This software is the GRIB_API (Application Programming Interface) library.

This software hides the binary layer of the message and uses a key/value approach to access the information in a GRIB message.

GRIB1 and GRIB2 uses the same function call.

Many keys to identify a parameter are edition independent, use these where possible!


GRIB_API can be used either through

Command line tools
Fortran90/C/Python interfaces


COMMAND-LINE GRIB TOOLS

The general use of the grib tools uses the following principle grib_tool <options> grib_file1 grib_file2... [output file]


grib_ls       lists the messages in a GRIB file
grib_dump     provides a more detailed view and listing of the file
grib_get

grib_get_data
grib_compare
grib_count
grib_copy
grib_set
grib_filter