Skip to content

Commit

Permalink
attempting to fix file comparison issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AlysonStahl-NOAA committed May 16, 2024
1 parent 8e22684 commit 5e120e8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions tests/run_wgrib2_rpn_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ echo "*** Running wgrib2 rpn tests"
echo "*** Converting temperatures from K to C"
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -match ":TMP:0.01" -rpn "273.15:-" -text celsius.txt
touch celsius.txt
cmp celsius.txt data/ref_celsius.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt
diff celsius.txt data/ref_celsius.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt

echo "*** Converting temperatures from K to F"
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -match ":TMP:0.01" -rpn "273.15:-:9:*:5:/:32:+" -text fahrenheit.txt
touch fahrenheit.txt
cmp fahrenheit.txt data/ref_fahrenheit.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt
diff fahrenheit.txt data/ref_fahrenheit.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt

echo "*** Takes relative humidity values, limits them to 100 and outputs to grib file"
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -match ":RH:" -if ":RH:" -rpn "100:min" -fi -grib_out rh.grb -not_if ":RH:" -grib rh.grb
../wgrib2/wgrib2 rh.grb > rh.txt
touch rh.txt
cmp rh.txt data/ref_rh.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt
diff 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):" \
Expand All @@ -34,7 +34,7 @@ echo "*** Calculates wind speed for records 1-25, then returns the average, min,

../wgrib2/wgrib2 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
diff min_max_ave_windspeed.txt data/ref_rpn.windspeed.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt

echo "*** SUCCESS!"
exit 0
36 changes: 18 additions & 18 deletions tests/run_wgrib2_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,51 @@ ls -l ../wgrib2

echo "*** testing inventory of gdaswave.t00z.wcoast.0p16.f000.grib2..."
../wgrib2/wgrib2 data/gdaswave.t00z.wcoast.0p16.f000.grib2 > tmp.txt
cat tmp.txt
cmp tmp.txt data/ref_gdaswave.t00z.wcoast.0p16.f000.grib2.inv
touch tmp.txt
diff tmp.txt data/ref_gdaswave.t00z.wcoast.0p16.f000.grib2.inv

echo "*** Testing calculation of number of grid points"
../wgrib2/wgrib2 data/gdaswave.t00z.wcoast.0p16.f000.grib2 -npts > npts.txt
cat npts.txt
cmp npts.txt data/ref_npts_gdaswave.t00z.wcoast.0p16.f000.grib2.txt
touch npts.txt
diff npts.txt data/ref_npts_gdaswave.t00z.wcoast.0p16.f000.grib2.txt

echo "*** Testing 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
touch wind.txt
diff 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
touch uv.txt
diff uv.txt data/ref_uv.gdas.t12z.pgrb2.1p00.anl.75r.grib2.inv

echo "*** Testing 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
touch grid_test.txt
diff grid_test.txt data/ref_grid.gdaswave.t00z.wcoast.0p16.f000.grib2.txt

echo "*** Testing Sec0"
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -Sec0 -grib_out sec0.grb
../wgrib2/wgrib2 sec0.grb > sec0.txt
cat sec0.txt
cmp sec0.txt data/ref_sec0.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt
touch sec0.txt
diff sec0.txt data/ref_sec0.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt

echo "*** Testing checksum on section 0"
../wgrib2/wgrib2 sec0.grb -checksum 0 > chksum1.txt
../wgrib2/wgrib2 data/ref_sec0.gdas.t12z.pgrb2.1p00.anl.75r.grib2 -checksum 0 > chksum2.txt
touch chksum1.txt
touch chksum2.txt
cmp chksum1.txt chksum2.txt
diff chksum1.txt chksum2.txt

echo "*** Testing sec_len"
../wgrib2/wgrib2 data/gdaswave.t00z.wcoast.0p16.f000.grib2 -Sec_len > sec_len.txt
cat sec_len.txt
cmp sec_len.txt data/ref_sec_len.gdaswave.t00z.wcoast.0p16.f000.grib2.txt
touch sec_len.txt
diff sec_len.txt data/ref_sec_len.gdaswave.t00z.wcoast.0p16.f000.grib2.txt

echo "*** Testing sec_len on a small file"
../wgrib2/wgrib2 data/ref_simple_packing.grib2 -Sec_len > sec_len_small.txt
cat sec_len_small.txt
cmp sec_len_small.txt data/ref_sec_len.simple_packing.grib2.txt
touch sec_len_small.txt
diff sec_len_small.txt data/ref_sec_len.simple_packing.grib2.txt

echo "*** Testing separating grib messages into separate files then recombining into single file"
# creating comparison file using match
Expand Down Expand Up @@ -104,7 +104,7 @@ fi
echo "*** Testing spread output"
../wgrib2/wgrib2 data/ref_simple_packing.grib2 -v2 -spread spread.txt
touch spread.txt
cmp data/ref_simple_packing.grib2.spread.txt spread.txt
diff data/ref_simple_packing.grib2.spread.txt spread.txt

echo "*** Testing write/read section"
../wgrib2/wgrib2 data/ref_simple_packing.grib2 -write_sec 0 sec0.dat -write_sec 1 sec1.dat \
Expand Down

0 comments on commit 5e120e8

Please sign in to comment.