Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding more tests #123

Merged
merged 13 commits into from
May 2, 2024
Merged
2 changes: 1 addition & 1 deletion .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
gcovr --root .. -v --html-details --exclude ../tests --exclude CMakeFiles --print-summary -o test-coverage.html &> /dev/null

- name: cache-data
if: steps.cache-data.outputs != 'true'
if: steps.cache-data.outputs.cache-hit != 'true'
run: |
mkdir ~/data
cp $GITHUB_WORKSPACE/wgrib2/build/tests/data/* ~/data
Expand Down
6 changes: 5 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ copy_test_data(gdaswave.t00z.wcoast.0p16.f000.grib2)
copy_test_data(ref_gdaswave.t00z.wcoast.0p16.f000.grib2.inv)
copy_test_data(ref_npts_gdaswave.t00z.wcoast.0p16.f000.grib2.txt)
copy_test_data(ref_WW3_Regional_US_West_Coast_20220718_0000.grib2.inv)
copy_test_data(gdas.t12z.pgrb2.1p00.anl.75r.grib2)
copy_test_data(ref_wind.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv)
copy_test_data(ref_uv.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv)
copy_test_data(ref_grid.gdaswave.t00z.wcoast.0p16.f000.grib2.txt)

# Run these shell tests.
shell_test(run_wgrib2_tests)

if (FTP_TEST_FILES)
shell_test(run_wgrib2_ftp_tests)
endif()
endif()
Binary file added tests/data/gdas.t12z.pgrb2.1p00.anl.75r.grib2
Binary file not shown.
76 changes: 76 additions & 0 deletions tests/data/ref_grid.gdaswave.t00z.wcoast.0p16.f000.grib2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
1:0:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
2:15254:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
3:37897:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
4:53794:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
5:69064:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
6:79482:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
7:91308:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
8:108541:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
9:116716:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
10:128832:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
11:140848:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
12:151732:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
13:161021:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
14:173676:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
15:189425:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
16:205285:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
17:218263:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
18:237035:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
19:259223:grid_template=0:winds(N/S):
lat-lon grid:(241 x 151) units 1e-06 input WE:NS output WE:SN res 48
lat 50.000000 to 25.000000 by 0.166667
lon 210.000000 to 250.000000 by 0.166667 #points=36391
14 changes: 14 additions & 0 deletions tests/data/ref_uv.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
1:0:d=2024042612:UGRD:0.01 mb:anl:
2:89774:d=2024042612:VGRD:0.01 mb:anl:
3:179548:d=2024042612:UGRD:0.02 mb:anl:
4:269322:d=2024042612:VGRD:0.02 mb:anl:
5:359096:d=2024042612:UGRD:0.04 mb:anl:
6:473305:d=2024042612:VGRD:0.04 mb:anl:
7:587514:d=2024042612:UGRD:0.07 mb:anl:
8:701723:d=2024042612:VGRD:0.07 mb:anl:
9:815932:d=2024042612:UGRD:0.1 mb:anl:
10:905706:d=2024042612:VGRD:0.1 mb:anl:
11:995480:d=2024042612:UGRD:0.2 mb:anl:
12:1109689:d=2024042612:VGRD:0.2 mb:anl:
13:1223898:d=2024042612:UGRD:0.4 mb:anl:
14:1338107:d=2024042612:VGRD:0.4 mb:anl:
14 changes: 14 additions & 0 deletions tests/data/ref_wind.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
1:0:d=2024042612:WDIR:0.01 mb:anl:
2:73484:d=2024042612:WIND:0.01 mb:anl:
3:163258:d=2024042612:WDIR:0.02 mb:anl:
4:236742:d=2024042612:WIND:0.02 mb:anl:
5:326516:d=2024042612:WDIR:0.04 mb:anl:
6:400000:d=2024042612:WIND:0.04 mb:anl:
7:514209:d=2024042612:WDIR:0.07 mb:anl:
8:587693:d=2024042612:WIND:0.07 mb:anl:
9:701902:d=2024042612:WDIR:0.1 mb:anl:
10:775386:d=2024042612:WIND:0.1 mb:anl:
11:865160:d=2024042612:WDIR:0.2 mb:anl:
12:938644:d=2024042612:WIND:0.2 mb:anl:
13:1052853:d=2024042612:WDIR:0.4 mb:anl:
14:1126337:d=2024042612:WIND:0.4 mb:anl:
17 changes: 16 additions & 1 deletion tests/run_wgrib2_tests.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# This is a test script for the wgrib2 project.
#
# Ed Hartnett, 3/27/24
# Ed Hartnett, Alyson Stahl 3/27/24

set -e
echo ""
Expand All @@ -24,5 +24,20 @@ cmp tmp.txt data/ref_gdaswave.t00z.wcoast.0p16.f000.grib2.inv
cat npts.txt
cmp npts.txt data/ref_npts_gdaswave.t00z.wcoast.0p16.f000.grib2.txt

# Tests the calculation of wind speed, direction, and UGRD & VGRD components
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -wind_dir wind.grb -wind_speed wind.grb -match "(UGRD|VGRD)"
../wgrib2/wgrib2 wind.grb > wind.txt
cat wind.txt
cmp wind.txt data/ref_wind.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv
../wgrib2/wgrib2 wind.grb -wind_uv uv.grb
../wgrib2/wgrib2 uv.grb > uv.txt
cat uv.txt
cmp uv.txt data/ref_uv.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv

# Tests printing of grid information
../wgrib2/wgrib2 data/gdaswave.t00z.wcoast.0p16.f000.grib2 -grid > grid_test.txt
cat grid_test.txt
cmp grid_test.txt data/ref_grid.gdaswave.t00z.wcoast.0p16.f000.grib2.txt

echo "*** SUCCESS!"
exit 0
Loading