Skip to content

Commit

Permalink
Merge pull request #129 from AlysonStahl-NOAA/as_ip
Browse files Browse the repository at this point in the history
Adding tests which test use of ip external library
  • Loading branch information
AlysonStahl-NOAA authored Jul 8, 2024
2 parents 9c52e09 + 123000b commit 72f4e79
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 2 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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
84 changes: 84 additions & 0 deletions tests/data/ref_new_grid_gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions tests/run_ipolates_tests.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 72f4e79

Please sign in to comment.