GRIB2 - DATA REPRESENTATION TEMPLATE 5.2

Grid point data - complex packing

Created 09/27/2005

Note:  For most templates, details of the packing process are described in Regulation 92.9.4.


Octet No. Contents
12-15 reference value (R) (IEEE 32-bit floating-point value)
16-17 Binary scale factor (E)
18-19 Decimal scale factor (D)
20 Number of bits used for each packed value for simple packing, or for each group reference value for complex packing or spatial differencing
 21 Type of original field values (see Code Table 5.1)
22
Group splitting method used (see Code Table 5.4)
23
Missing value management used (see Code Table 5.5)
24-27
Primary missing value substitute
28-31 Secondary missing value substitute
32-35
NG ― number of groups of data values into which field is split
36
Reference for group widths (see Note 12)
37
Number of bits used for the group widths (after the reference value in octet 36 has been removed)
38-41
Reference for group lengths (see Note 13)
42
Length increment for the group lengths (see Note 14)
43-46
True length of last group
47
Number of bits used for the scaled group lengths (after subtraction of the reference value given in octets 38-41 and division by the length increment given in octet 42)



Notes:

(1) Group lengths have no meaning for row by row packing, where groups are coordinate lines (so th grid description
section and possibly the bit-map section are enough); for consistency, associated field width and reference should then be
encoded as 0.

(2) For row by row packing with a bit-map, there should always be as many groups as rows. In case of rows with only
missing values, all associated descriptors should be coded as zero.

(3) Management of widths into a reference and increments, together with management of lengths as scaled incremental
values, are intended to save descriptor size (which is an issue as far as compression gains are concerned).

4) Management of explicitly missing values is an alternate to bit-map use within Section 6; it is intended to reduce the whole
GRIB message size.

(5) There may be two types of missing value(s), such as to make a distinction between static misses (for instance, due to a
land/sea mask) and occasional misses.

(6) As an extra option, substitute value(s) for missing data may be specified. If not wished (or not applicable), all bits
should be set to 1 for relevant substitute value(s).

(7) If substitute value(s) are specified, type of content should be consistent with appropriate group with original field values
(floating-point ― and then IEEE 32-bit encoded-, or integer).

(8) If secondary missing values are used, such values are encoded within appropriate group with all bits set to 1 at packed
data level.

(9) If secondary missing values are used, such values are encoded within appropriate group with all bits set to 1, except the
last one set to 0, at packed data level.

(10) A group containing only missing values (of either type) will be encoded as a constant group (null width, no associate data)
and the group reference will have all bits set to 1 for primary type, and all bits set to 1, except the last bit set to 0, for
secondary type.

(11) If necessary, group widths and/or field width of group references may be enlarged to avoid ambiguities between missing
value indicator(s) and true data.

(12) The group width is the number of bits used for every value in a group.

(13) The group length (L) is the number of values in a group.

(14) The essence of the complex packing method is to subdivide a field of values into NG groups, where the values in each
group have similar sizes. In this procedure, it is necessary to retain enough information to recover the group lengths upon
decoding. The NG group lengths for any given field can be described by Ln = ref + Kn x len_inc, n = 1,NG, where
ref is given by octets 38 - 41 and len_inc by octet 42. The NG values of K (the scaled group lengths) are stored in the
data section, each with the number of bits specified by octet 47. Since the last group is a special case which may not be
able to be specified by this relationship, the length of the last group is stored in octets 43-46.

(15) See data template 7.2 and associated notes for complementary information.


Back