mirror of https://github.com/ecmwf/eccodes.git
Testing: grib_to_netcdf
This commit is contained in:
parent
5b702b03fc
commit
71c091f8f9
|
@ -425,7 +425,7 @@ if( HAVE_BUILD_TOOLS )
|
|||
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_to_netcdf
|
||||
TYPE SCRIPT
|
||||
CONDITION HAVE_NETCDF AND ENABLE_EXTRA_TESTS
|
||||
CONDITION HAVE_NETCDF AND ENABLE_EXTRA_TESTS AND NOT ECCODES_ON_WINDOWS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_to_netcdf.sh
|
||||
TEST_DEPENDS eccodes_download_gribs )
|
||||
|
||||
|
|
|
@ -36,35 +36,35 @@ if command -v "ncdump" >/dev/null 2>&1; then
|
|||
NC_DUMPER="ncdump"
|
||||
fi
|
||||
|
||||
if [ $ECCODES_ON_WINDOWS -eq 0 ]; then
|
||||
echo "Test ECC-1041: One parameter with different expvers ..."
|
||||
# ------------------------------------------------------------
|
||||
# This has 5 messages, all 'tp'. Change the first message to have a different expver
|
||||
input=${data_dir}/tp_ecmwf.grib
|
||||
${tools_dir}/grib_set -w stepRange=12 -s experimentVersionNumber=0005 $input $tempGrib
|
||||
${tools_dir}/grib_to_netcdf -o $tempNetcdf $tempGrib
|
||||
if test "x$NC_DUMPER" != "x"; then
|
||||
$NC_DUMPER -h $tempNetcdf > $tempText
|
||||
grep -q "short tp_0005" $tempText
|
||||
grep -q "short tp_0001" $tempText
|
||||
fi
|
||||
|
||||
echo "Test HDF5 decoding ..."
|
||||
# ---------------------------
|
||||
# Note: this is only available in NetCDF-4. So need to check if the command worked with -k3
|
||||
input=${data_dir}/sample.grib2
|
||||
set +e
|
||||
${tools_dir}/grib_to_netcdf -k3 -o $tempNetcdf $input 2>/dev/null
|
||||
stat=$?
|
||||
set -e
|
||||
if [ $stat -eq 0 ]; then
|
||||
have_netcdf4=1
|
||||
${tools_dir}/grib_dump -TA -O $tempNetcdf
|
||||
res=`${tools_dir}/grib_get -TA -p identifier $tempNetcdf`
|
||||
[ "$res" = "HDF5" ]
|
||||
fi
|
||||
echo "Test ECC-1041: One parameter with different expvers ..."
|
||||
# ------------------------------------------------------------
|
||||
# This has 5 messages, all 'tp'. Change the first message to have a different expver
|
||||
input=${data_dir}/tp_ecmwf.grib
|
||||
${tools_dir}/grib_set -w stepRange=12 -s experimentVersionNumber=0005 $input $tempGrib
|
||||
${tools_dir}/grib_to_netcdf -o $tempNetcdf $tempGrib
|
||||
if test "x$NC_DUMPER" != "x"; then
|
||||
$NC_DUMPER -h $tempNetcdf > $tempText
|
||||
grep -q "short tp_0005" $tempText
|
||||
grep -q "short tp_0001" $tempText
|
||||
fi
|
||||
|
||||
echo "Test HDF5 decoding ..."
|
||||
# ---------------------------
|
||||
# Note: this is only available in NetCDF-4. So need to check if the command worked with -k3
|
||||
input=${data_dir}/sample.grib2
|
||||
set +e
|
||||
${tools_dir}/grib_to_netcdf -k3 -o $tempNetcdf $input 2>/dev/null
|
||||
stat=$?
|
||||
set -e
|
||||
if [ $stat -eq 0 ]; then
|
||||
have_netcdf4=1
|
||||
${tools_dir}/grib_dump -TA -O $tempNetcdf
|
||||
res=`${tools_dir}/grib_get -TA -p identifier $tempNetcdf`
|
||||
[ "$res" = "HDF5" ]
|
||||
fi
|
||||
|
||||
|
||||
grib_files="\
|
||||
regular_latlon_surface.grib2 \
|
||||
regular_latlon_surface.grib1 \
|
||||
|
|
Loading…
Reference in New Issue