2013-12-23 03:53:20 +08:00
|
|
|
#!/bin/sh
|
2018-03-05 20:38:00 +08:00
|
|
|
|
|
|
|
# This shell script runs tst_interops2 to create a HDF4 file, and read
|
|
|
|
# it with netCDF. Then the script runs ncdump on the HDF4 file.
|
|
|
|
|
2017-11-18 22:36:24 +08:00
|
|
|
# Ed Hartnett
|
2013-12-23 03:53:20 +08:00
|
|
|
|
2017-03-09 08:01:10 +08:00
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
|
|
|
. ../test_common.sh
|
|
|
|
|
2013-12-23 03:53:20 +08:00
|
|
|
FILE=tst_interops2.h4
|
|
|
|
|
|
|
|
ECODE=0
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "*** Testing extended file format output."
|
|
|
|
set -e
|
|
|
|
|
2017-11-18 22:36:24 +08:00
|
|
|
echo "Creating HDF4 file"
|
|
|
|
${execdir}/tst_interops2
|
|
|
|
|
2013-12-23 03:53:20 +08:00
|
|
|
echo "Test extended format output for a HDF4 file"
|
2017-11-18 22:36:24 +08:00
|
|
|
rm -f tmp_tst_formatx_hdf4
|
|
|
|
${NCDUMP} -K $FILE >tmp_tst_formatx_hdf4
|
|
|
|
if ! fgrep 'HDF4 mode=00001000' <tmp_tst_formatx_hdf4 ; then
|
|
|
|
TMP=`cat tmp_tst_formatx_hdf4`
|
2013-12-23 03:53:20 +08:00
|
|
|
echo "*** Fail: extended format for an HDF4 file: result=" $TMP
|
|
|
|
ECODE=1
|
|
|
|
fi
|
|
|
|
|
2017-11-18 22:36:24 +08:00
|
|
|
rm -f tmp_tst_formatx_hdf4
|
2013-12-23 03:53:20 +08:00
|
|
|
|
2018-03-05 18:45:18 +08:00
|
|
|
# Exit if there was a failure.
|
|
|
|
if test $ECODE = 1 ; then
|
|
|
|
exit $ECODE
|
|
|
|
fi
|
2013-12-23 03:53:20 +08:00
|
|
|
|
2018-03-05 18:45:18 +08:00
|
|
|
echo ""
|
|
|
|
echo "*** Testing reading an individual variable from an HDF4 file."
|
|
|
|
|
|
|
|
${NCDUMP} -v hdf4_dataset_type_0 $FILE
|
|
|
|
${NCDUMP} -v hdf4_dataset_type_1 $FILE
|
|
|
|
${NCDUMP} -v hdf4_dataset_type_2 $FILE
|
|
|
|
${NCDUMP} -v hdf4_dataset_type_3 $FILE
|
|
|
|
${NCDUMP} -v hdf4_dataset_type_4 $FILE
|
|
|
|
${NCDUMP} -v hdf4_dataset_type_5 $FILE
|
|
|
|
${NCDUMP} -v hdf4_dataset_type_6 $FILE
|
|
|
|
${NCDUMP} -v hdf4_dataset_type_7 $FILE
|
|
|
|
|
|
|
|
echo "*** Success."
|
2013-12-23 03:53:20 +08:00
|
|
|
|