diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index 2f8dddcd..2c323909 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -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 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index db468e87..b2b9b985 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -84,6 +84,11 @@ endif() 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) @@ -91,9 +96,6 @@ shell_test(run_wgrib2_tests) if (FTP_TEST_FILES) copy_test_data(ref_WW3_Regional_US_West_Coast_20220718_0000.grib2.inv) shell_test(run_wgrib2_ftp_tests) -endif() - -if (FTP_EXTRA_TEST_FILES) copy_test_data(ref_rrfs.t18z.prslev.f000.grib2.inv) shell_test(run_ftp_extra_large_tests) endif() diff --git a/tests/data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 b/tests/data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 new file mode 100644 index 00000000..4e264f9d Binary files /dev/null and b/tests/data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 differ diff --git a/tests/data/ref_grid.gdaswave.t00z.wcoast.0p16.f000.grib2.txt b/tests/data/ref_grid.gdaswave.t00z.wcoast.0p16.f000.grib2.txt new file mode 100644 index 00000000..e567d608 --- /dev/null +++ b/tests/data/ref_grid.gdaswave.t00z.wcoast.0p16.f000.grib2.txt @@ -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 diff --git a/tests/data/ref_uv.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv b/tests/data/ref_uv.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv new file mode 100644 index 00000000..f819edc4 --- /dev/null +++ b/tests/data/ref_uv.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv @@ -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: diff --git a/tests/data/ref_wind.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv b/tests/data/ref_wind.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv new file mode 100644 index 00000000..73b6bb79 --- /dev/null +++ b/tests/data/ref_wind.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv @@ -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: diff --git a/tests/run_wgrib2_tests.sh b/tests/run_wgrib2_tests.sh old mode 100644 new mode 100755 index 39e8385d..2555e976 --- a/tests/run_wgrib2_tests.sh +++ b/tests/run_wgrib2_tests.sh @@ -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 "" @@ -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