...
Template 4.0: instantaneous deterministic product | Template 4.1: instantaneous probabilistic product | ||
10 | Parameter category (Code table 4.1) | 10 | Parameter category (Code table 4.1) |
---|---|---|---|
11 | Parameter number (Code table 4.2, Code table 4.2.0.0 for temperature*) | 11 | Parameter number (Code table 4.2, Code table 4.2.0.0 for temperature*) |
12 | Type of generating process (Code table 4.3) | 12 | Type of generating process (Code table 4.3) |
13 | Background generating process identifier | 13 | Background generating process identifier |
14 | Forecast generating process identifier | 14 | Forecast generating process identifier |
15-16 | Hours after reference time of data cut-off | 15-16 | Hours after reference time of data cut-off |
17 | Minutes after reference time of data cut-off | 17 | Minutes after reference time of data cut-off |
18 | Indicator of unit of time range ( Code table 4.4) | 18 | Indicator of unit of time range (Code table 4.4) |
19-22 | Forecast time in units defined by octet 18 | 19-22 | Forecast time in units defined by octet 18 |
23 | Type of first fixed surface (Code table 4.5) | 23 | Type of first fixed surface (Code table 4.5) |
24 | Scale factor of first fixed surface | 24 | Scale factor of first fixed surface |
25-28 | Scaled value of first fixed surface | 25-28 | Scaled value of first fixed surface |
29 | Type of second fixed surface (Code table 4.5) | 29 | Type of second fixed surface (Code table 4.5) |
30 | Scale factor of second fixed surface | 30 | Scale factor of second fixed surface |
31-34 | Scaled value of second fixed surface | 31-34 | Scaled value of second fixed surface |
35 | Type of ensemble forecast (Code table 4.6) | ||
36 | Perturbation number | ||
37 | Number of forecasts in ensemble |
...
The section length is encoded at the beginning of each section so that the decoder knows how long each section is. For template 4.0, the section 4 length is 34 and for template 4.1 37 bytes long. Which template is used, is encoded in the section itself.The key parameterNumber doesn't have a Code Table to itself, meaning the Code Table 4.2 is divided into subtables 4.2.[discipline].[parameterCategory], for example 4.2.0.0 for temperature.
Bytes 8 to 9 of the section 4 contain the Product Definition Template Number, which would be set for the examples shown here to 0 respectively 1. In the same way, the Grid Definition Template Number in section 3 and the Data Representation Template Number in section 5 are defined. This means that the decoder has to know the structure of the template to be able to decode the message.
...
Code Block | ||
---|---|---|
| ||
# generate two GRIB2 files with templates 4.0 and 4.1 grib_set -s productDefinitionTemplateNumber=0 $(codes_info -s)/GRIB2.tmpl PDTN_4_0.grib2 grib_set -s productDefinitionTemplateNumber=1 $(codes_info -s)/GRIB2.tmpl PDTN_4_1.grib2 # compare the dumps of section 4 grib_dump -O -p section_4 PDTN_4_0.grib2 grib_dump -O -p section_4 PDTN_4_1.grib2 diff <(grib_dump -O -p section_4 PDTN_4_0.grib2) <(grib_dump -O -p section_4 PDTN_4_1.grib2) |
* The key parameterNumber has the Code Table 4.2 divided into subtables 4.2.[discipline].[parameterCategory], for example 4.2.0.0 for temperature.