Octet No. | Contents |
| 1-3 | Length of section (octets) |
| 4 | Flag (see Code table 11) (first 4 bits).
Number of unused bits at end of Section 4 (last 4 bits) |
| 5-6 | Scale factor (E) |
| 7-10 | Reference value (minimum of packed values) |
| 11 | Number of bits containing each packed value |
| 12- | Variable, depending on the flag value in octet 4 |
Note: A negative value of E shall be indicated by setting the high-order bit (bit 1) in the left-hand octet to 1 (on).
|
Grid-point data - simple packing:
|
Octet No. | Contents |
| 12- | Binary data |
Spherical harmonic coefficients - simple packing: |
Octet No. | Contents |
| 12-15 | Real part of (0,0) coefficient (stored in the same manner as the reference value (octets 7-10) |
| 16- | Binary data |
Grid-point data - second-order packing |
Octet No. | Contents |
| 12-13 | N1 - octet number at which first-order packed data begin |
| 14 | Extended flags (see Code table 11) |
| 15-16 | N2 - octet number at which second-order packed data begin |
| 17-18 | P1 - number of first-order packed values |
| 19-20 | P2 - number of second-order packed values |
| 21 | Reserved |
| 22-(xx-1) | Width(s) in bits of second-order packed values; each width is contained in 1 octet |
| xx-(N1-1) | Secondary bit-map, at least P2 bits long, padded to a whole number of octets with binary 0 |
| N1-(N2-1) | P1 first-order packed values, padded to a whole number of octets with binary 0 |
| N2-... | P2 second-order packed values |
NOTES:
|
- The binary data shall consist of P1 first-order packed values, of width given by the contents of octet 11, followed by P2 second-order packed values; there shall be one second-order packed value for each point of the defined grid, as modified by application of the bit-map in Section 3 - Bit-map section, if present.
- The width of the second-order packed values shall be indicated by the values of W2j:
- If bit 8 of the extended flags (Code table 11) is 0, all second-order packed values will have the same width, indicated by a single value of W21;
- If bit 8 of the extended flags (Code table 11) is 1, P1 values of the widths of second-order packed values (W2j, j = 1..P1) will be given.
- The secondary bit-map, starting at octet xx, shall define with corresponding 1 bits the location where the use of the first-order packed values begins with reference to the defined grid (as modified by the bit-map, Section 3, if present); the first point of the grid, as modified by the bit-map in Section 3, if present, will always be present, and a corresponding 1 shall be set in the first bit of the secondary bit-map.
- Where bit 7 of the extended flags (Code table 11) is 0, the secondary bit-map shall be omitted; and implied secondary bit-map shall be inferred such that a 1 bit is set for the first point of each row (or column) of the defined grid (row by row packing).
- The original represented data at any point shall be obtained by scanning the points in the order defined by the grid description, as modified by the (optional) bit-map section; each first-order packed value shall remain defined until the point at which the use of a subsequent first-order packed value begins, as defined by the secondary bit-map; the unpacked value shall be obtained by applying the reference value, the binary and the decimal scales to the sum of the first- and second-order values for each point, by the following formula:
Y x 10D = R + (Xi + Xj) x 2E
| where | Xi is the appropriate first-order packed value |
| Xj is the appropriate second-order packed value |
- If the number of bits W2j, for the appropriate subset, is zero, no values for that subset are represented; i.e. the actual value for that subset is constant given by R + (Xi x 2E). This is a form of run-length encoding in which a string of identical values is represented by one value; the replication count for that value is, implicitly, in the secondary bit-map.
|
Spherical harmonics - complex packing: |
Octet No. | Contents |
| 12-13 | N (relative to the beginning of the BDS, except for ECMWF fields where it is relative to the beginning of the GRIB record) |
| 14-15 | IP (where IP = int (1000 x P)) |
| 16 | J1 |
| 17 | K1 |
| 18 | M1 |
| 19 | Binary data |
| . | Unpacked binary data represented in 4 octets in the same way as the reference value (pairs of coefficients) |
| . |
| . |
| N | Packed binary data |
NOTES: |
- Removal of the real (0,0) coefficient considerably reduces the variability of the coefficients and results in better packing.
- For some spherical harmonic representations, the (0,0) coefficient represents the mean value of the parameter represented.
- For spherical harmonics - complex packing, J1, K1, M1 are the pentagonal resolution parameters specifying the truncation of a subset of the data, which shall be represented unpacked (as is the reference value) and shall precede the packed data.
P defines a scaling factor by which is packed not the field itself, but the modulus of Del2P of the field, where Del2 is the Laplacian operator. Thus the coefficients (phin)m will be multiplied by (n (n + 1))P before packing, and divided by this factor after unpacking. N is a pointer to the start of the packed data (i.e. gives octet number)
(J1, K1, M1 > 0 and P 0, + or -)
The representation mode (Code figure = 2 in Code table 10) in Section 2 shall indicate this type of packing, but as Section 2 is optional, the flag field in this section may also be used to indicate the more complex method.
|