mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
2ea1cf5f1b
stored in the _NCProperties attribute to allow two things: 1. capture of additional library dependencies (over and above hdf5) 2. Recognition of non-netcdf libraries that create netcdf-4 format files. To this end, the _NCProperties format has been extended to be and arbitrary set of key=value pairs separated by commas. This new format has version = 2, and uses commas as the pair separator. Thus the general form is: _NCProperties = "version=2,key1=value,key2=value2..." ; This new version is accompanied by a new ./configure option of the form --with-ncproperties="key1=value1,key2=value2..." that specifies pairs to add to the _NCProperties attribute for all files created with that netcdf library. At this point, what is missing is some programmatic way to specify either all the pairs or additional pairs to the _NCProperties attribute. Not sure of the best way to do this. Builders using non-netcdf libraries can specify whatever they want in the key value pairs (as long as the version=2 is specified first). By convention, the primary library is expected to be the the first pair after the leading version=2 pair, but this is convention only and is neither required nor enforced. Related changes: 1. Fixed the tests that check _NCProperties to properly operate with version=2. 2. When reading a version 1 _NCProperties attribute, convert it to look like a version 2 attribute. 2. Added some version 2 tests to ncdump/tst_fileinfo.c and ncdump/tst_fileinfo.sh Misc Changes: 1. Fix minor problem in ncdap_test/testurl.sh where a parameter to buildurl needed to be quoted. 2. Minor fix to ncgen to swap switches -H and -h to be consistent with other utilities. 3. Document the -M flag in nccopy usage() and the nccopy man page. 4. Modify a test case to use the nccopy -M flag.
67 lines
1.5 KiB
Bash
Executable File
67 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# Author: Dennis Heimbigner
|
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
|
. ../test_common.sh
|
|
|
|
set -e
|
|
echo ""
|
|
|
|
EXIT=0
|
|
|
|
NCF="./nc4_fileinfo.nc"
|
|
HDF="./hdf5_fileinfo.hdf"
|
|
|
|
NF="${top_srcdir}/ncdump/ref_tst_compounds4.nc"
|
|
NPV1="${top_srcdir}/ncdump/ref_provenance_v1.nc"
|
|
|
|
# Create various files
|
|
${execdir}/tst_fileinfo
|
|
|
|
# Do a false negative test
|
|
rm -f ./tst_fileinfo.tmp
|
|
if $NCDUMP -s $NF | fgrep '_IsNetcdf4 = 0' > ./tst_fileinfo.tmp ; then
|
|
echo "Pass: False negative for file: $NF"
|
|
else
|
|
echo "FAIL: False negative for file: $NF"
|
|
EXIT=1
|
|
fi
|
|
|
|
rm -f ./tst_fileinfo.tmp
|
|
if test -e $NCF ; then
|
|
# look at the _IsNetcdf4 flag
|
|
N_IS=`${NCDUMP} -s $NCF | fgrep '_IsNetcdf4' | tr -d ' ;'`
|
|
N_IS=`echo $N_IS | cut -d= -f2`
|
|
H_IS=`${NCDUMP} -s $HDF | fgrep '_IsNetcdf4' | tr -d ' ;'`
|
|
H_IS=`echo $H_IS | cut -d= -f2`
|
|
if test "x$N_IS" = 'x0' ;then
|
|
echo "FAIL: $NCF is marked as not netcdf-4"
|
|
EXIT=1
|
|
fi
|
|
if test "x$H_IS" = 'x1' ;then
|
|
echo "FAIL: $HDF is marked as netcdf-4"
|
|
EXIT=1
|
|
fi
|
|
else
|
|
echo "FAIL: tst_fileinfo: $NCF does not exist"
|
|
EXIT=1
|
|
fi
|
|
|
|
# Test what happens when we read a file that used provenance version 1
|
|
rm -f ./tst_fileinfo.tmp ./tst_fileinfo2.tmp
|
|
$NCDUMP -hs $NPV1 >tst_fileinfo2.tmp
|
|
fgrep '_NCProperties' <tst_fileinfo2.tmp > ./tst_fileinfo.tmp
|
|
if ! fgrep 'version=1' tst_fileinfo.tmp ; then
|
|
echo "FAIL: $NPV1 is not marked as version=1"
|
|
EXIT=1
|
|
fi
|
|
|
|
rm -f $NCF
|
|
rm -f $HDF
|
|
rm -f *.tmp
|
|
|
|
if test "x$EXIT" = x0 ; then
|
|
echo "*** Pass all tests"
|
|
fi
|
|
exit $EXIT
|