Fast downloading of GRIB2 Files
from the NCEP NOMAD Server
(Partial HTTP Transfers)


Using this procedure, you can download just the data you need from a remote GRIB2 file.

Note that in the examples below, the convention for the index files uses the ".idx" suffix, used on both the WOC server and the server.

These instructions were adapted for this site from  Wesley Ebisuzaki's Fast Downloading of GRIB files website.  Please visit this site for more details.


The http protocol allows "random access" reading of GRIB files.  This procedure requires an index file and an http program that supports random access.   The wgrib inventory is used for the index file, and cURL is used for the random-access http program.   Both are freely available, widely used, work on many platforms and are easily scripted/automated/put into a cronjob.  Two perl scripts are also required, and,  which are downloadable from the NCEP CPC website (see "Requirements" below).

The basic format of the quick download is: INV_URL | grep FIELDS | GRIB_URL OUTPUT

  • INV_URL is the URL of a wgrib inventory, for example:
  • FIELDS is string that selects the desired fields (wgrib compatible), for example:
    ":HGT:500 mb:"
  • GRIB_URL is the URL of the grib file, for example:
  • OUTPUT is the name of the for the downloaded grib file

The " INV_URL" downloads the wgrib inventory off the net and adds a range field.

The "grep FIELDS" uses the grep command to select desired fields from the inventory. Use of the "grep FIELDS" is similar to the procedure used when using wgrib to extract fields.

The " GRIB_URL OUTPUT" uses the filtered inventory to select the fields from GRIB_URL to download. The selected fields are saved in OUTPUT.  

See the wgrib home page for more information and tricks on using grep and egrep.

This example downloads the the 500 mb height from the 12 hour (f12) from the 00Z (t00z) GFS fcst from the NCEP NOMAD server:

GRIB_URL="" $INV_URL | grep ":HGT:500 mb:" | $GRIB_URL out.grb
This example is similar to the above example except it downloads both the 500 mb height and the 1000 mb temperature:

GRIB_URL="" $INV_URL| grep "(:HGT:500 mb:|:TMP:1000 mb:)" |  $GRIB_URL out.grb
If you want to download multiple fields, for example, precipitation and 2 meter temperature, you can type,  
     URL="" $URL.idx | egrep ':(PRATE|TMP:2 m above gnd):' | $URL out
The above code will put the precipiation and 2-m temp in the file "out". Egrep understands regular expressions which is a very powerful feature.

If you are doing multiple downloads from the same file, you can save time by keeping a local copy of the inventory. For example:

     URL="" $URL.idx > my_inv
     grep ":UGRD:" < my_inv | $URL ugrd.grb
     grep ":VGRD:" < my_inv | $URL vgrd.grb
     grep ":TMP:" < my_inv | $URL tmp.grb
The above code saves two extra downloads of the inventory. 

  1. perl
  2. grep
  3. cURL
  4. grib files and their wgrib inventory on an http server
Configuration (UNIX/Linux)
The first two lines of and need to be modified. The first line should point to your perl interpreter. The second line needs to point to the location of curl if it is not on your path.

Usage: Windows

There have been some reports that the perl scripts didn't work on Windows machines.  Please see Wesley Ebisuzaki's Fast Downloading of GRIB files page for more information and solutions to Windows access problems.