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 -u

wgrib2: -precision


Except for grid values stored in IEEE format, grid values are stored with user-defined precision. By having a variable precision, the space required can be reduced. For having the temperature stored to a thousandth of a degree would be wasteful as thermometers typically give a result to a tenth of a degree.

Grid point values are stored as scaled integers, the scaling determines the precision.

val = (base+i*2^bin_scaling)*10^dec_scaling
       base = real*4
       bin_scaling = integer from -127 .. 127
       dec_scaling = integer from -127 .. 127

The -precision option prints the bin_scaling and dec_scaling values. The -precision output can be read by -set_metadata and -set_metadata_str options to set the precision.




$ wgrib2 -precision
1:0:encode i*2^-4*10^0

$ wgrib2 wind.grb -precision
1:0:encode i*2^0*10^-1
2:97922:encode i*2^0*10^-1
3:179554:encode i*2^0*10^-1

See also: -packing, -scale, -set_bin_prec, -set_metadata, -set_metadata_str, -set_scale,

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: July 10, 2014
Disclaimer Privacy Policy