NOAA logo-Select to go to the NOAA homepage
NOAA / NWS's Meteorological Development Laboratory   
  Select to go to the NWS homepage
GRIB1 logo Degrib (NDFD GRIB2 Decoder) GRIB2 logo
Local forecast by
"City, St"

Degrib: Test Suites

Step 1 Get a test suite.

To test the program, I have provided some sample test "suites". Each "suite" consists of test scripts in /degrib/test, the GRIB2 data needed for the test in /degrib/test/data, and the answers in /degrib/test/ans. The test basically consists of converting the data for the first message in the GRIB2 file to .flt file, and ArcView point shape files.

To save space, only the Maximum Temperature suite contains the "answers" for ArcView point files (.shp, .shx, and .dbf). All the tests create the ArcView files, and all the .shp and .shx files are identical, so they can be compared to the "answer" ones from Maximum Temperature. As for the .dbf, if the .flt files match then it is fairly safe to assume that the .dbf will as well, particularly if the Maximum Temperature one worked.

To get the .shp file to be identical on the 3 test platforms (Linux, HP-unix, PC) we rounded to 10^-5. This means locations are correct up to a square which is +/- 1m on a side, since
360 deg = 2 PI Re
=> 1 deg = (2 PI * 6371200 m) / 360 = 111198 m
=> .00001 deg = 1.11198 m

Available Test Suites:

  1. Maximum Temperature (NDFD Data from 11/15/2002):
    degrib-testtmax.tar.gz (19,502,386 bytes : 10/13/2005)

  2. Maximum Temperature and Relative Humidity (NDFD Data from 11/18/2002):
    degrib-testnewtmax.tar.gz (1,036,776 bytes : 10/13/2005)

  3. Minimum Temperature (NDFD Data from 11/15/2002):
    degrib-testtmin.tar.gz (945,479 bytes : 10/13/2005)

  4. PoP 12 (NDFD Data from 11/15/2002):
    degrib-testpop.tar.gz (435,986 bytes : 10/13/2005)

  5. Temperature (NDFD Data from 11/15/2002):
    degrib-testt.tar.gz (4,541,935 bytes : 10/13/2005)

  6. Dew Point (NDFD Data from 11/15/2002):
    degrib-testtd.tar.gz (2,583,502 bytes : 10/13/2005)

  7. Sky (NDFD Data from 10/8/2002):
    degrib-testsky.tar.gz (709,082 bytes : 10/13/2005)

  8. Wind Speed (NDFD Data from 10/8/2002):
    degrib-testwnds.tar.gz (508,075 bytes : 10/13/2005)

  9. Wind Direction (NDFD Data from 10/8/2002):
    degrib-testwndd.tar.gz (2,077,903 bytes : 10/13/2005)

Step 2 Expand the test suite.

MS-Windows: I assume here that you are using cygwin.  However, you could use WinZip and a "command prompt" (located in start->programs->accessories).  If you do use the "command prompt", the directory name would start with: "c:\ndfd\degrib20\>".)

  1. ~taylor> cd c:/ndfd/degrib20
  2. /cygdrive/c/ndfd/degrib20> gunzip -c /download/degrib-testsky.tar.gz | tar -xf -
  3. /cygdrive/c/ndfd/degrib20> cd test

UNIX / Linux:

  1. ~taylor> cd ./degrib
  2. ~taylor/degrib> gunzip -c /download/degrib-testsky.tar.gz | tar -xf -
  3. ~taylor/degrib> cd test

Step 3 Perform the test.


  1. /cygdrive/c/ndfd/degrib20/test> ./testtmax.bat

UNIX / Linux:

  1. ~taylor/degrib/test> ./

Step 4 Check the results.

What we want to do is a binary comparison of the files generated in /degrib/test with their corresponding files in /degrib/test/ans to make sure they are the same. To do so we use a 'chk' script, which in turn uses diff to compare the test results to the accepted answers.

MS-Windows: Although I assume you are using cygwin, I have provided a free MS-DOS version of diff in /degrib/bin, so the 'chk' scripts will work from a "command prompt".

  1. /cygdrive/c/ndfd/degrib20/test> ./chk_tmax.bat

UNIX / Linux:

  1. ~taylor/degrib/test/> ./

If you want to test the tkdegrib program, you can do so by using the GUI to choose the first message, storing the results in /degrib/test, and then running the 'chk' script.

Limitations: Currently, the 'test' and 'chk' scripts only test the degrib program with the first GRIB2 message in the file.

Where do I go from here?

    US Dept of Commerce
    National Oceanic and Atmospheric Administration
    National Weather Service
    Meteorological Development Laboratory
    1325 East West Highway
    Silver Spring, MD 20910
    Page last Modified: May 11, 2006.
Degrib Questions? Arthur Taylor
NDFD Questions?
XML Questions? Paul Hershberg & John Schattel
Information Quality
Privacy Policy
Freedom of Information Act (FOIA)
About Us
Career Opportunities