Grid point data - complex packing and spatial differencing

Created 10/05/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)
Group splitting method used (see Code Table 5.4)
Missing value management used (see Code Table 5.5)
Primary missing value substitute
28-31 Secondary missing value substitute
32-35 NG ― number of groups of data values into which field is split
Reference for group widths (see Note 12)
Number of bits used for the group widths (after the reference value in octet 36 has been removed)
Reference for group lengths (see Note 13)
Length increment for the group lengths (see Note 14)
True length of last group
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)
Order of spatial difference (see Code Table 5.6)
Number of octets required in the data section to specify extra descriptors needed for spatial differencing (octets 6-ww in data template 7.3)


(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.

(A) Spatial differencing is a pre-processing before group splitting at encoding time. It is intended to reduce the size of
sufficiently smooth fields, when combined with a splitting scheme as described in data representation template 5.2.
At order 1, an initial field of values f is replaced by a new field of values g, where g1 = f1, g2 = f2, ..., gn = fn - fn-1.
At order 2, the field of values g is itself replaced by a new field of values h, where h1 = f1, h2 = f2 , h3 = g3- g2, ...,
hn = gn - gn - 1. To keep values positive, the overall minimum of the resulting field (either gmin or hmin) is removed. At
decoding time, after bit string unpacking, the original scaled values are recovered by adding the overall minimum and
summing up recursively.

(B) For differencing of order n, the first n values in the array that are not missing are set to zero in the packed array. These
dummy values are not used in unpacking.

(C) See data template 7.3 and associated notes for complementary information.