bilingrb - A bilinear GRIB interpolator & subsampler

bilingrb is a program for extraction, interpolation, or subsampling of geographic subdomains from GRIB 2D-fields in lat-lon format. The records are interpolated using bilinear interpolation, not the most subtle of techniques, but frequently close enough for .gov work.

Comments are appreciated, future versions may appear.


  % bilingrb gribfile newgribfile westlon southlat dlon dlat nlon nlat

where gribfile & newgribfile are the old and new GRIB files,westlon,southlat are the coords of the SW corner in your new grid, dlon & dlat define the east and north resolution in degrees, and nlon & nlat define the grid size in the east and north direction, respectively.

Facts & caveats


1. If world.grb is a global file with resolution 1.5 x 1.5 deg, then

  % bilingrb world.grb smallworld.grb -10.0 45.0 0.5 0.5 51 71

produces a 51x71 interpolated subdomain with bounding coordinates (45N,10W) and (80N,15E) with resolution 0.5 x 0.5 deg.

2. If a subsampled version of world.grb with resolution 3.0 x 3.0 deg is desired, then

  % bilingrb world.grb sparseworld.grb 0.0 -90.0 3.0 3.0 121 61

yields a 121x61 subsampled grid of the whole domain, assuming the original grid has a node at (90S,0E). Note that when subsampling it is recommended that you select westlon, southlat to coincide with a grid point in the old grid and dlon, dlat to be multiples of the old grid resolution. This circumvents interpolation error and avoids bloated coastlines if dealing with undef'd points (dry points in a wet dataset).


% tar -xvf gribw.tar
% cd gribw
% make -f gribwlib.make
% cd ../bilingrb
% make -f bilingrb.make

The gribw library (gribw.tar) home page will have links to the current version of gribw.tar.

See also

ggrib, a program for extracting subdomains without interpolating.
wgrib, a program for viewing and extracting records.
gribw, grib writing library

v1.1, 2004-01-22,, 5/2006 revised links WNE

Øyvind Breivik, Norwegian Meteorological Institute,