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 > wgrib2api: undefined values

wgrib2api: undefined values


In grib2, the grid points can have undefined values. Grib doesn't doesn't use a special value to indicate an undefined but uses one of 3 methods.

  1. a bitmap (used by jpeg2000, simple, ieee and by complex packing)
  2. the IEEE 754 format undefined (ieee packing)
  3. a special bit pattern by complex packing (prefered)

However, users usually find a special value the easiest method to indicate an undefined value. Wgrib2api, like wgrib2, uses the value 9.999e20 to indicate a special value. There are one symbolic values and two functions in wgrib2api (v2.0.8) to handle undefined values.

  • grb2_UNDEFINED: symbolic value for 9.999e20
  • grb2_UNDEFINED_VAL(x): returns true if x is the undefined values otherwise false
  • grb2_DEFINED_VAL(x): returns true if x is a defined values otherwise false


    grid(i,j) = grb2_UNDEFINED
       set grid(i,j) to the special undefined values 9.999e20
    if (grb2_UNDEFINED(grid(i,j)) then
       if grid(i,j) is undefined than
    if (grb2_DEFINED(grid(i,j)) then
       if grid(i,j) is defined than

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: Jan 25, 2018
Disclaimer Privacy Policy