diff --git a/.github/workflows/Linux_options.yml b/.github/workflows/Linux_options.yml index debbad55..c646aae9 100644 --- a/.github/workflows/Linux_options.yml +++ b/.github/workflows/Linux_options.yml @@ -33,6 +33,9 @@ jobs: - { options: "-DUSE_AEC=ON" } + - { + options: "-DUSE_NETCDF4=ON" + } steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index 121feb66..ee45764a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,7 +148,7 @@ FILE(WRITE "wgrib2/config.h" "/* config.h generated by cmake */\n") FILE(APPEND "wgrib2/config.h" "#ifndef _CONFIG_H\n") FILE(APPEND "wgrib2/config.h" "#define _CONFIG_H\n") -FOREACH(var IN ITEMS USE_NETCDF3 USE_NETCDF4 USE_HDF5 USE_REGEX USE_TIGGE USE_MYSQL +FOREACH(var IN ITEMS USE_NETCDF3 USE_REGEX USE_TIGGE USE_MYSQL USE_IPOLATES USE_UDF USE_OPENMP USE_PROJ4 USE_WMO_VALIDATION DISABLE_TIMEZONE DISABLE_ALARM USE_NAMES USE_G2CLIB USE_PNG USE_JASPER USE_OPENJPEG MAKE_FTN_API USE_AEC BUILD_COMMENTS) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index be697549..dce8d33d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -91,12 +91,21 @@ 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.inv) copy_test_data(ref_grid.gdaswave.t00z.wcoast.0p16.f000.grib2.txt) + # Run these shell tests. shell_test(run_wgrib2_tests) +if (USE_NETCDF4) + shell_test(run_wgrib2_netcdf4_tests) +endif() +if (USE_NETCDF3) + shell_test(run_wgrib2_netcdf3_tests) +endif() + if (USE_AEC) shell_test(run_wgrib2_aec_tests) endif() + if (FTP_TEST_FILES) shell_test(run_wgrib2_ftp_tests) endif() diff --git a/tests/run_wgrib2_netcdf3_tests.sh b/tests/run_wgrib2_netcdf3_tests.sh new file mode 100644 index 00000000..9618c455 --- /dev/null +++ b/tests/run_wgrib2_netcdf3_tests.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# This checks the use of AEC compression, only available if USE_NETCDF4 is turned on in CMake. +# +# Alyson Stahl, 4/22/24 + +set -e +set -x + +# make template +../wgrib2/wgrib2 data/tmp_int.grb -rpn 0 -grib_out junk.template + +# make netcdf file +../wgrib2/wgrib2 data/tmp_int.grb -nc3 -netcdf junk.nc + +# convert netcdf to grb +../wgrib2/wgrib2 junk.template -import_netcdf junk.nc TMP_500mb "0:1:0:181:0:360" -grib_out junk.grb + +n=`../wgrib2/wgrib2 data/tmp_int.grb -var -lev -rpn "sto_1" -import_grib junk.grb -rpn "rcl_1:print_rms" | \ +grep -v ":rpn=0:" | wc -l` + +rm junk.grb junk.nc junk.template +if [ "$n" -eq 1 ] ; then + echo "success" + exit 0 +else + exit 1 +fi + diff --git a/tests/run_wgrib2_netcdf4_tests.sh b/tests/run_wgrib2_netcdf4_tests.sh new file mode 100644 index 00000000..ce8e5478 --- /dev/null +++ b/tests/run_wgrib2_netcdf4_tests.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# This checks the use of AEC compression, only available if USE_NETCDF4 is turned on in CMake. +# +# Alyson Stahl, 4/22/24 + +set -e +set -x + +# make template +../wgrib2/wgrib2 data/tmp_int.grb -rpn 0 -grib_out junk.template + +# make netcdf file +../wgrib2/wgrib2 data/tmp_int.grb -nc4 -netcdf junk.nc + +# convert netcdf to grb +../wgrib2/wgrib2 junk.template -import_netcdf junk.nc TMP_500mb "0:1:0:181:0:360" -grib_out junk.grb + +n=`../wgrib2/wgrib2 data/tmp_int.grb -var -lev -rpn "sto_1" -import_grib junk.grb -rpn "rcl_1:print_rms" | \ +grep -v ":rpn=0:" | wc -l` + +rm junk.grb junk.nc junk.template +if [ "$n" -eq 1 ] ; then + echo "success" + exit 0 +else + exit 1 +fi + diff --git a/wgrib2/Config.c b/wgrib2/Config.c index 7e55577b..eface0f8 100644 --- a/wgrib2/Config.c +++ b/wgrib2/Config.c @@ -46,10 +46,10 @@ int f_config(ARG0) { #else strcat(inv_out, "Netcdf package is not installed\n"); #endif -#if defined USE_NETCDF4 - strcat(inv_out, "netcdf4: " USE_NETCDF4 "\n"); - strcat(inv_out, "hdf5: " USE_HDF5 "\n"); -#endif +//#if defined USE_NETCDF4 +// strcat(inv_out, "netcdf4: " USE_NETCDF4 "\n"); +// strcat(inv_out, "hdf5: " USE_HDF5 "\n"); +//#endif #ifdef USE_AEC strcat(inv_out, USE_AEC " is installed\n" ); #endif