Skip Navigation Links 
NOAA logo - Click to go to the NOAA home page National Weather Service   NWS logo - Click to go to the NWS home page
Climate Prediction Center

About Us
   Our Mission
   Who We Are

Contact Us
   CPC Information
   CPC Web Team

HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grib_max_bits

wgrib2: -grib_max_bits


When wgrib2 encodes a grib message (creates a new grib message), the grid values are usually stored as scaled integers. The number of bits required to store the scaled integers will depend on the precision/scaling factors. If these values are poorly set, the scaled integers could be 100 bits long. That would be very inconvenient for machines with 32-bit registers. To prevent this problem, you have to limit the size of the scaled integers. The wgrib2 default is 16 bits, and can be increased up to 25 bits by the -set_grib_max_bits option. Since the IEEE single precision floating point format only has 25 bits of precision, there is little need to support longer scaled integers at this point in time (9/2017). The -grib_max_bits option displays the current value of the maximum binary precision.

Grib decoders usually have a limit to the size of the scaled integers used to store grid values. Wgrib2 has a limit of 25 bits which is determined by the minimum size of the integer (32 bits) and the algorithm used to convert between a bitsting and integer. I don't know the limits for other software packages.

-grib_max_bits INTEGER
               INTEGER between 1 and 25
See also: -scaling, -set_grib_max_bits,

NOAA/ National Weather Service
National Centers for Environmental Prediction
Climate Prediction Center
5830 University Research Court
College Park, Maryland 20740
Climate Prediction Center Web Team
Page last modified Feb 21, 2018
Disclaimer Privacy Policy