Skip to content

Commit

Permalink
swapped checksum comparison for inventory comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
AlysonStahl-NOAA committed Apr 29, 2024
1 parent 3f5dd51 commit 3341add
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 16 deletions.
6 changes: 3 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ 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)
copy_test_data(ref_wind.gdas.t12z.pgrb2.1p00.anl.75r)
copy_test_data(ref_uv.gdas.t12z.pgrb2.1p00.anl.75r)
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.inx)

# Run these shell tests.
shell_test(run_wgrib2_tests)
Expand Down
Binary file removed tests/data/gdas.t12z.pgrb2.1p00.anl.75r
Binary file not shown.
Binary file removed tests/data/ref_uv.gdas.t12z.pgrb2.1p00.anl.75r
Binary file not shown.
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:
Binary file removed tests/data/ref_wind.gdas.t12z.pgrb2.1p00.anl.75r
Binary file not shown.
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:
20 changes: 7 additions & 13 deletions tests/run_wgrib2_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,14 @@ 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
cksum_wind_0=`../wgrib2/wgrib2 data/ref_wind.gdas.t12z.pgrb2.1p00.anl.75r -text - | cksum`
cksum_uv_0=`../wgrib2/wgrib2 data/ref_uv.gdas.t12z.pgrb2.1p00.anl.75r -text - | cksum`
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r -wind_dir wind.grb -wind_speed wind.grb -match "(UGRD|VGRD)"
cksum_wind_1=`../wgrib2/wgrib2 wind.grb -text - | cksum`
if [ "$cksum_wind_0" != "$cksum_wind_1" ] ; then
echo "failed for computing wind speed and direction"
exit 1
fi
../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
cksum_uv_1=`../wgrib2/wgrib2 uv.grb -text - | cksum`
if [ "$cksum_uv_0" != "$cksum_uv_1" ] ; then
echo "failed for computing UGRD & VGRD components"
exit 1
fi
../wgrib2/wgrib2 uv.grb > uv.txt
cat uv.txt
cmp uv.txt data/ref_uv.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv

echo "*** SUCCESS!"
exit 0

0 comments on commit 3341add

Please sign in to comment.