In GRIB2, the spectral coefficients are split into two groups and stored differently.
High-resolution coefficients
The high-resolution coefficients are stored directly as floating-point numbers. The precision used for these coefficients is controlled by the unpackedSubsetPrecision key:
unpackedSubsetPrecision
0 -> IBM 32-bit floating point
1 -> IEEE 32-bit floating point, which is the default in the sample files
2 -> IEEE 64-bit floating pointFor example, to store the unpacked subset using IEEE 64-bit floating-point values, use:
grib_set -r -s unpackedSubsetPrecision=2 in.grib out.gribLow-resolution coefficients
The low-resolution coefficients are encoded using a modified form of Simple Packing. Each packed integer value uses bitsPerValue bits. The decimal scale factor and binary scale factor are chosen based on bitsPerValue.
The value is calculated as follows:
packed_value = round(((x * 10^D * (n(n+1))^p) - R) * 2^(-E))where:
x = original coefficient value
D = decimal scale factor
E = binary scale factor
R = reference value
p = Laplacian operator
n = spectral wavenumberRelated articles