diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index ee4fce92..c5faa784 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -69,6 +69,22 @@ jobs: make -j2 make install + - name: checkout-ip + uses: actions/checkout@v4 + with: + repository: NOAA-EMC/NCEPLIBS-ip + path: ip + ref: v3.3.3 + + - name: build-ip + run: | + cd ip + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=~/ip -DCMAKE_PREFIX_PATH=~/sp + make -j2 + make install + - name: checkout-ip2 uses: actions/checkout@v4 with: @@ -121,7 +137,7 @@ jobs: export CFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0' export FCFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0' export FFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0' - cmake .. -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON + cmake .. -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/ip2;~/sp" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON make VERBOSE=1 ctest --verbose --output-on-failure --rerun-failed gcovr --root .. -v --html-details --exclude ../tests --exclude CMakeFiles --print-summary -o test-coverage.html &> /dev/null diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2841a9ea..0f25a28e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -106,6 +106,8 @@ copy_test_data(ref_sec0.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt) copy_test_data(ref_sec_len.gdaswave.t00z.wcoast.0p16.f000.grib2.txt) copy_test_data(ref_sec_len.simple_packing.grib2.txt) copy_test_data(ref_simple_packing.grib2.spread.txt) +copy_test_data(ref_new_grid_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt) +copy_test_data(ref_new_grid_earth_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt) # Run these shell tests. shell_test(run_wgrib2_tests) @@ -120,7 +122,9 @@ endif() if (USE_NETCDF3) shell_test(run_wgrib2_netcdf3_tests) endif() - +if (USE_IPOLATES) + shell_test(run_ipolates_tests) +endif() if (USE_AEC) shell_test(run_wgrib2_aec_tests) endif() diff --git a/tests/data/ref_new_grid_earth_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt b/tests/data/ref_new_grid_earth_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt new file mode 100644 index 00000000..0c1ab74d --- /dev/null +++ b/tests/data/ref_new_grid_earth_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt @@ -0,0 +1,84 @@ +1:0:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +2:8324:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +3:16648:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +4:24972:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +5:33296:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +6:41620:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +7:49944:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +8:58268:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +9:66592:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +10:74916:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +11:83240:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +12:91564:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +13:99888:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +14:108212:grid_template=0:winds(N/S): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 diff --git a/tests/data/ref_new_grid_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt b/tests/data/ref_new_grid_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt new file mode 100644 index 00000000..b8a43f49 --- /dev/null +++ b/tests/data/ref_new_grid_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt @@ -0,0 +1,84 @@ +1:0:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +2:179:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +3:358:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +4:537:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +5:716:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +6:895:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +7:1074:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +8:1253:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +9:1432:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +10:1611:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +11:1790:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +12:1969:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +13:2148:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 +14:2327:grid_template=0:winds(grid): + lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 56 + lat 0.000000 to 180.000000 by 1.000000 + lon 0.000000 to 359.000000 by 1.000000 #points=65160 + basic_ang=0 sub_angle=1000000 units=0.000001 + unscaled lat=0 to 180000000 lon=0 to 359000000 diff --git a/tests/run_ipolates_tests.sh b/tests/run_ipolates_tests.sh new file mode 100644 index 00000000..b15574f0 --- /dev/null +++ b/tests/run_ipolates_tests.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# This checks the use of ip external library, only available if USE_IPOLATES=ON CMake. +# +# Alyson Stahl 5/9/2024 + +set -e + +echo "*** Testing conversion from earth to grid" +../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -match "(UGRD|VGRD)" -new_grid_winds grid \ + -new_grid latlon 0:360:1 00:181:1 new_grid.grb +../wgrib2/wgrib2 new_grid.grb -grid -v2 > new_grid.txt +touch new_grid.txt +diff -w new_grid.txt data/ref_new_grid_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt + +echo "*** Testing conversion from grid to earth" +../wgrib2/wgrib2 new_grid.grb -new_grid_winds earth \ + -new_grid latlon 0:360:1 00:181:1 new_grid_earth.grb +../wgrib2/wgrib2 new_grid_earth.grb -grid -v2 > new_grid_earth.txt +touch new_grid_earth.txt +diff -w new_grid_earth.txt data/ref_new_grid_earth_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt + +echo "*** SUCCESS!" +exit 0 \ No newline at end of file