Skip to content

Commit

Permalink
adding more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlysonStahl-NOAA committed May 15, 2024
1 parent dec1311 commit dbff085
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/run_wgrib2_netcdf4_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,29 @@ if [ "$n" -ne 1 ] ; then
exit 1
fi

echo "*** Testing converting from grib to netcdf on larger grib file using nc_nlev"
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -match ":(UGRD|VGRD|HGT|TMP):" -grib_out junk_netcdf.template
echo "*** Testing converting from grib to netcdf to grib with multiple variables"
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -match ":(UGRD|VGRD|HGT|TMP):0.4 mb" -grib_out temp.grib2
../wgrib2/wgrib2 temp.grib2 -rpn 0 -grib_out junk_netcdf.template
../wgrib2/wgrib2 temp.grib2 -nc4 -netcdf junk_netcdf.nc
../wgrib2/wgrib2 junk_netcdf.template -import_netcdf junk_netcdf.nc HGT_0D4mb "0:1:0:181:0:360" \
-import_netcdf junk_netcdf.nc TMP_0D4mb "0:1:0:181:0:360" \
-import_netcdf junk_netcdf.nc UGRD_0D4mb "0:1:0:181:0:360" \
-import_netcdf junk_netcdf.nc VGRD_0D4mb "0:1:0:181:0:360" \
-grib_out junk_netcdf.grb

cksum0=`../wgrib2/wgrib2 temp.grib2 -text - | cksum`
cksum1=`../wgrib2/wgrib2 junk_netcdf.grb -text - | cksum`
if [ "$cksum0" != "$cksum1" ] ; then
exit 1
fi
rm junk_netcdf.grb junk_netcdf.nc junk_netcdf.template

echo "*** Testing converting from grib to netcdf with variables stored in 3D structure"
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -nc_nlev 7 -netcdf junk_netcdf.nc -match ":(UGRD|VGRD|HGT|TMP):"
ncdump -v HGT,TMP,UGRD,VGRD junk_netcdf.nc > netcdf.txt
touch netcdf.txt
cmp data/ref_ncdump4.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt netcdf.txt


echo "*** SUCCESS!"
exit 0

0 comments on commit dbff085

Please sign in to comment.