DeGRIB Testing - MDL
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:
- Maximum Temperature (NDFD Data from 11/15/2002):
degrib-testtmax.tar.gz * (19,502,386 bytes : 10/13/2005)
- Maximum Temperature and Relative Humidity (NDFD Data from 11/18/2002):
degrib-testnewtmax.tar.gz * (1,036,776 bytes : 10/13/2005)
- Minimum Temperature (NDFD Data from 11/15/2002):
degrib-testtmin.tar.gz * (945,479 bytes : 10/13/2005)
- PoP 12 (NDFD Data from 11/15/2002):
degrib-testpop.tar.gz * (435,986 bytes : 10/13/2005)
- Temperature (NDFD Data from 11/15/2002):
degrib-testt.tar.gz * (4,541,935 bytes : 10/13/2005)
- Dew Point (NDFD Data from 11/15/2002):
degrib-testtd.tar.gz * (2,583,502 bytes : 10/13/2005)
- Sky (NDFD Data from 10/8/2002):
degrib-testsky.tar.gz * (709,082 bytes : 10/13/2005)
- Wind Speed (NDFD Data from 10/8/2002):
degrib-testwnds.tar.gz * (508,075 bytes : 10/13/2005)
- 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\>".)
- ~taylor> cd c:/ndfd/degrib20
- /cygdrive/c/ndfd/degrib20> gunzip -c /download/degrib-testsky.tar.gz | tar -xf -
- /cygdrive/c/ndfd/degrib20> cd test
UNIX / Linux:
- ~taylor> cd ./degrib
- ~taylor/degrib> gunzip -c /download/degrib-testsky.tar.gz | tar -xf -
- ~taylor/degrib> cd test
Step 3 Perform the test.
- /cygdrive/c/ndfd/degrib20/test> ./testtmax.bat
UNIX / Linux:
- ~taylor/degrib/test> ./testtmax.sh
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".
- /cygdrive/c/ndfd/degrib20/test> ./chk_tmax.bat
UNIX / Linux:
- ~taylor/degrib/test/> ./chk_tmax.sh
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.