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

wgrib2: -box_ave


The -box_ave option does a spatial smoothing by doing a simple box average of the data field. Amount of smoothing can be controlled by the size of the box. The -box_ave option can be used on regional and global fields. To identify global fields, you can use the option -cyclic.


   DX=width of box (in grid points), DX has to be an odd positive integer
   DY=height of box (in grid points), DY has to be an odd positive integer

   The box average is the mean value for a box of DX x DY centered on
   the grid point.

      -1: grid(i,j) = UNDEFINED    if original grid(i,j) is undefined
                    = box average  if original grid(i,j) is defined
       not -1: let wt = number of grid points that are defined in the box
            grid(i,j) = UNDEFINED     if wt <= WT
                      = box average   if wt > WT

The speed of -box_ave is O(NX*NY*DY). The O(NX*NY) method was slower
because of poor cache utilization and false sharing.


I had a high-resolution Gaussian grid and wanted to convert it to a 1x1 degree grid. There were about 81 grid points in a 1 degree cell. The budget interpolation in -new_grid worked but it was slow and worked by taking 25 bilinear interpolations and averaging them to make the budget interpolation. So the pre-existing solution was slow and slighly inaccurate. To interpolate scalars to the 1x1 grid, you can run a box_average with 9x9 grid and then use -new_grid to get the cell average values. This method is, as expected, slightly smoother than the budget interpolation of -new_grid. For vectors, you have to use the budget interpolation of the -new_grid option.

See also: -new_grid,

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 created March 8, 2018, Page last modified: March 9, 2018
Disclaimer Privacy Policy