You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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 point

For example, to store the unpacked subset using IEEE 64-bit floating-point values, use:

grib_set -r -s unpackedSubsetPrecision=2 in.grib out.grib

Low-resolution coefficients

The low-resolution coefficients are encoded using a modified form of Simple Packing. Their precision is controlled by bitsPerValue. The decimal scale factor and binary scale factor are chosen based on bitsPerValue. The packed integer value is calculated approximately as:

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 wavenumber
  • No labels