From - Mon Mar 22 15:10:30 2004 Return-Path: Received: from relay-east.nems.noaa.gov ([205.156.4.216]) by loft.ncep.noaa.gov (Netscape Messaging Server 4.15) with ESMTP id HRXTWU00.AKJ for ; Fri, 23 Jan 2004 05:17:18 -0500 Received: from mx-east3.nems.noaa.gov ([140.90.121.151]) by relay-east.nems.noaa.gov (Netscape Messaging Server 4.15) with SMTP id HRXTWU00.2WT for ; Fri, 23 Jan 2004 05:17:18 -0500 Received: from mail53.messagelabs.com(216.82.255.35) by mx-east3.nems.noaa.gov via csmap id 76144c28_4d8e_11d8_955f_003048227607_2859; Fri, 23 Jan 2004 05:25:27 -0500 (EST) X-Env-Sender: oyvind.breivik@met.no X-Msg-Ref: server-6.tower-53.messagelabs.com!1074853027!219991 X-StarScan-Version: 5.1.15; banners=-,-,- X-SpamReason: No, hits=1.5 required=7.0 tests=CYNIC_B_GOOD,HTML_30_40, HTML_MESSAGE,HTML_TAG_BALANCE_BODY,HTML_TAG_BALANCE_HTML, HTML_TITLE_EMPTY Received: (qmail 26705 invoked from network); 23 Jan 2004 10:17:16 -0000 Received: from smtp2.oslo.dnmi.no (128.39.62.242) by server-6.tower-53.messagelabs.com with SMTP; 23 Jan 2004 10:17:16 -0000 Received: from benguela.bergen.dnmi.no (met.no) [157.249.36.35] by smtp2.oslo.dnmi.no with esmtp (Exim 4.30 #1) id 1AjyN4-00060H-Or (Debian); Fri, 23 Jan 2004 10:17:02 +0000 Message-ID: <4010F49E.40706@met.no> Date: Fri, 23 Jan 2004 11:17:02 +0100 From: =?ISO-8859-1?Q?=D8yvind_Breivik?= Organization: Norwegian Meteorological Institute User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 MIME-Version: 1.0 To: Wesley.Ebisuzaki@noaa.gov CC: Rebecca Rudsar Subject: Re: bilingrb - a GRIB interpolator References: <1068028587.610.23.camel@benguela.bergen.dnmi.no> <3FA91705.1EDF8A91@noaa.gov> <400FBCA9.9020507@met.no> <400FDA19.1090000@met.no> In-Reply-To: <400FDA19.1090000@met.no> Content-Type: multipart/mixed; boundary="------------080309070706070704080904" X-SA-Do-Not-Run: DoIt X-SA-Exim-Rcpt-To: Wesley.Ebisuzaki@noaa.gov, rebecca.rudsar@met.no X-SA-Exim-Mail-From: oyvind.breivik@met.no X-SA-Exim-Scanned: No; SAEximRunCond expanded to false This is a multi-part message in MIME format. --------------080309070706070704080904 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I've updated the HTML documentation of the interpolator. Cheers, Oyvind --------------080309070706070704080904 Content-Type: text/html; name="bilingrb.html" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="bilingrb.html"

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.

Syntax

  % 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

  • The grid must be in geographic coordinates (lat-lon). The grid scan mode is arbitrary.
  • Do not use bilingrb with directional data, it will mess up your data seriously near the branch cut (where the wind direction shifts from 0 to 359 degrees). Such GRIB records must be weeded out in advance, for instance with wgrib, an excellent piece of software available at wesley.wwb.noaa.gov.
  • Vector components near the poles should be handled with care.
  • Cyclic grids (periodic in longitude) are allowed, selecting a subdomain that crosses the branch cut (0/360 or -180/180) is also allowed.
  • Subsampling is achieved by selecting the starting coordinates to coincide with the grid points in the old grid and choosing dlon and dlat, the resolution, to be multiples of the original resolution.
  • Undefined points (e.g. land in an ocean grid) are tackled by bilingrb.The new grid points become undefined if any of their neighbours in the old grid are undefined (except when the new grid point coincides exactly with a grid point in the old grid, this to avoid unnecessary swelling of coastlines when subsampling).
  • Specifying bounding coords that go beyond the original grid domain is verboten and will cause  bilingrb to quit, so make sure you weed out unwanted records from your GRIB file in advance.
  • The interpolation is weighted with the cosine of the latitude.

Examples

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).

Installation

% gunzip bilingrb.tar.gz
% cd Gribw
% make -f gribwlib.make
% cd ../Bilingrb
% make -f bilingrb.make

The TAR-ball includes a Linux binary of bilingrb, which makes compilation unnecessary for those fortunate owners of Linux boxes.

See also

ggrib, a program for extracting subdomains without interpolating.
wgrib, a program for viewing and extracting records.

v1.1, 2004-01-22, oyvind.breivik@met.no

--
Øyvind Breivik, Norwegian Meteorological Institute, www.met.no





--------------080309070706070704080904--