This article relates to GRIB edition 2
The purpose of the Product Definition section is to describe the nature of the data contained in the Data section.
Note that there are three categories of GRIB2 templates – Grid Definition Templates, Product Definition Templates and Data Representation Templates. They are identified by the Grid Definition Template Number, Product Definition Template Number, and Data Representation Template Number, respectively.
Here we describe the Product Definition Templates only. The ecCodes key for its template number is "productDefinitionTemplateNumber".
The Product Definition Templates are normally divided into groups of 4. For example the most commonly used ones are:
So for a product definition, we have two dimensions:
- Whether it is HRES (deterministic) or part of an ensemble
- Whether the field is instantaneous or interval-based (e.g. accumulated)
A Product Definition Template Number of 8 means "deterministic and interval-based". And 11 means an interval-based ensemble member.
In the latter case the GRIB message will have the key "perturbationNumber" but not in the former case because it is not part of an ensemble.
For examples of instantaneous parameters see: Mean sea level pressure and 2 metre temperature. For an interval-based parameter see: Maximum temperature at 2 metres in the last 24 hours.
To find out more about instantaneous and interval-based parameters, see ERA5 terminology: analysis and forecast; time and steps; instantaneous and accumulated and mean rates and min/max parameters.
Now there are other kinds of product groups which follow this pattern. Let's look at the atmospheric chemical constituents:
For the meaning of the various Product Definition Template numbers see https://codes.ecmwf.int/grib/format/grib2/templates/4/
You can also click on each entry to see the keys (contents) of the particular template e.g. for template 11, see https://codes.ecmwf.int/grib/format/grib2/templates/4/11/.
To view these templates in ecCodes, go to the grib2 definitions directory (this can be found via the "codes_info" command) and look for files named: template.4.*.def
Some of these will include other template files. Let's look at one example of the template numbers 8 and 11:
% codes_info ecCodes Version 2.17.0 Default definition files path is used: /usr/local/apps/eccodes/2.17.0/GNU/7.3.0/share/eccodes/definitions ... # Go to the definitions directory for GRIB edition 2 % cd /usr/local/apps/eccodes/2.17.0/GNU/7.3.0/share/eccodes/definitions/grib2 % cat template.4.11.def include "grib2/template.4.parameter.def" include "grib2/template.4.horizontal.def" include "grib2/template.4.eps.def" include "grib2/template.4.statistical.def" % cat template.4.8.def include "grib2/template.4.parameter.def" include "grib2/template.4.horizontal.def" include "grib2/template.4.statistical.def" # We see that the only difference is the inclusion of the ensemble file (template.4.eps.def) # Now look in this file to see what keys are there % more template.4.eps.def ... unsigned perturbationNumber : dump; ... # This tells us there is a one-octet key called perturbationNumber
It is also instructive to examine the template number 0 (deterministic and instantaneous):
% cat template.4.0.def include "grib2/template.4.parameter.def"; include "grib2/template.4.point_in_time.def"; include "grib2/template.4.horizontal.def";
Here you can see the ensemble part is absent and instead of template.4.statistical.def we have template.4.point_in_time.def (since instantaneous means a given point in time)