Versions Compared

Key

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

You want to dump a specific section of a GRIB message rather than all its sections.

Step-by-step guide

You can use the "-p" option of the grib_dump command

...

To find out the sections and their contents of each edition, see here:

 For example let's look at the Grid Description Section of a GRIB 1 file. This would be Section 2 for edition 1 so we use the key "section_2":

Code Block
% grib_dump -O -p section_2 data/regular_latlon_surface.grib1
======================   SECTION_2 ( length=32, padding=0 )    ======================
1-3       section2Length = 32
4         numberOfVerticalCoordinateValues = 0
5         pvlLocation = 255
6         dataRepresentationType = 0 [Latitude/Longitude Grid (grib1/6.table) ]
7-8       Ni = 16
9-10      Nj = 31
11-13     latitudeOfFirstGridPoint = 60000
14-16     longitudeOfFirstGridPoint = 0
17        resolutionAndComponentFlags = 128 [10000000]
18-20     latitudeOfLastGridPoint = 0
21-23     longitudeOfLastGridPoint = 30000
24-25     iDirectionIncrement = 2000
26-27     jDirectionIncrement = 2000
...

...

If a given section does not exist e.g. section 2 is optional in GRIB 2, then you get an error (Key/value not found).Note: .

The "-p" option can take one or more standard keys e.g. grib_dump -p Ni,Nj prints just those two keys and grib_dump -p pl prints the "pl" array.

Of course you can use the other grib_dump options e.g. "-j" to do a JSON dump or "-H" to see values in hex.


Info

This can be a very

...

efficient way of checking a set of keys without decoding others. For example if you have a very large data section, the standard grib_dump

...

would decode all its values whereas dumping a given non-data section will

...

skip decoding the data values and hence be quicker.


Content by Label
showLabelsfalse
max5
spacesUDOC
showSpacefalse
sortmodified
reversetrue
typepage
excludeCurrenttrue
cqllabel in ("grib_dump","grib","kb-how-to-article") and label = in ("grib_dump","keys") and label = "grib" and type = "page" and space = "UDOC"
labelsgrib kb-how-to-article grib_dump

...