Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlysonStahl-NOAA committed May 7, 2024
1 parent 740af43 commit d19420b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ copy_test_data(ref_grid.gdaswave.t00z.wcoast.0p16.f000.grib2.txt)
copy_test_data(ref_celsius.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt)
copy_test_data(ref_fahrenheit.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt)
copy_test_data(ref_rh.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt)

copy_test_data(ref_rpn.windspeed.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt)
# Run these shell tests.
shell_test(run_wgrib2_tests)
shell_test(run_wgrib2_rpn_tests)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1:0:rpn_min=0.0335829:rpn_max=113.815:rpn_ave=32.1264:d=2024042612:WIND:0.01 mb:anl:
2:97919:rpn_min=0.0590511:rpn_max=109.028:rpn_ave=31.408:d=2024042612:WIND:0.02 mb:anl:
13 changes: 13 additions & 0 deletions tests/run_wgrib2_rpn_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,18 @@ echo "*** Takes relative humidity values, limits them to 100 and outputs to grib
touch rh.txt
cmp rh.txt data/ref_rh.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt

echo "*** Calculates wind speed for records 1-25, then returns the average, min, and max values"
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -for 1:25 -match ":(UGRD|VGRD):" \
-if ":UGRD:" -rpn "sto_1" -fi \
-if ":VGRD:" -rpn "sto_2" -fi \
-if_reg 1:2 \
-rpn "rcl_1:sq:rcl_2:sq:+:sqrt:clr_1:clr_2" \
-set_var WIND \
-grib_out tmp_windspeed.grb

../wgrib2/wgrib2.exe tmp_windspeed.grb -rpn print_min -rpn print_max -rpn print_ave > min_max_ave_windspeed.txt
touch min_max_ave_windspeed.txt
cmp min_max_ave_windspeed.txt data/ref_rpn.windspeed.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt

echo "*** SUCCESS!"
exit 0

0 comments on commit d19420b

Please sign in to comment.