2022-09-04 04:57:48 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
|
|
|
. ../test_common.sh
|
|
|
|
|
2022-10-19 05:12:04 +08:00
|
|
|
. "$top_srcdir/nczarr_test/test_nczarr.sh"
|
2022-09-04 04:57:48 +08:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-10-09 01:22:52 +08:00
|
|
|
s3isolate "testdir_scalar"
|
2023-04-26 07:15:06 +08:00
|
|
|
THISDIR=`pwd`
|
|
|
|
cd $ISOPATH
|
|
|
|
|
|
|
|
# This shell script tests support for the NC_STRING type
|
|
|
|
|
2022-09-04 04:57:48 +08:00
|
|
|
zarrscalar() {
|
|
|
|
rm -f $2
|
|
|
|
sed -e '/dimensions:/d' -e '/_scalar_ =/d' -e '/int v/ s|(_scalar_)||' <$1 >$2
|
|
|
|
}
|
|
|
|
|
|
|
|
testcase() {
|
|
|
|
zext=$1
|
|
|
|
|
|
|
|
echo "*** Test: scalar write/read"
|
|
|
|
|
|
|
|
# Get pure zarr args
|
|
|
|
fileargs tmp_scalar_zarr "mode=zarr,$zext"
|
|
|
|
zarrurl="$fileurl"
|
|
|
|
zarrfile="$file"
|
|
|
|
# Get nczarr args
|
|
|
|
fileargs tmp_scalar_nczarr "mode=nczarr,$zext"
|
|
|
|
nczarrurl="$fileurl"
|
|
|
|
nczarrfile="$file"
|
|
|
|
|
|
|
|
# setup
|
|
|
|
deletemap $zext $zarrfile
|
|
|
|
deletemap $zext $nczarrfile
|
|
|
|
|
|
|
|
# Create alternate ref files
|
|
|
|
echo "*** create pure zarr file"
|
2022-10-19 05:12:04 +08:00
|
|
|
${NCGEN} -4 -b -o "$zarrurl" $top_srcdir/nczarr_test/ref_scalar.cdl
|
2022-09-04 04:57:48 +08:00
|
|
|
echo "*** create nczarr file"
|
2022-10-19 05:12:04 +08:00
|
|
|
${NCGEN} -4 -b -o "$nczarrurl" $top_srcdir/nczarr_test/ref_scalar.cdl
|
2022-09-04 04:57:48 +08:00
|
|
|
|
|
|
|
echo "*** read purezarr"
|
2023-10-09 01:22:52 +08:00
|
|
|
${NCDUMP} -n ref_scalar $zarrurl > tmp_scalar_zarr_${zext}.cdl
|
2022-09-04 04:57:48 +08:00
|
|
|
${ZMD} -h $zarrurl > tmp_scalar_zarr_${zext}.txt
|
|
|
|
echo "*** read nczarr"
|
|
|
|
${NCDUMP} -n ref_scalar $nczarrurl > tmp_scalar_nczarr_${zext}.cdl
|
|
|
|
${ZMD} -h $nczarrurl > tmp_scalar_nczarr_${zext}.txt
|
|
|
|
|
|
|
|
echo "*** verify"
|
2022-10-19 05:12:04 +08:00
|
|
|
diff -bw $top_srcdir/nczarr_test/ref_scalar.cdl tmp_scalar_nczarr_${zext}.cdl
|
2022-09-04 04:57:48 +08:00
|
|
|
|
|
|
|
# Fixup
|
2023-10-09 01:22:52 +08:00
|
|
|
zarrscalar tmp_scalar_zarr_${zext}.cdl tmp_rescale_zarr_${zext}.cdl
|
|
|
|
diff -bw $top_srcdir/nczarr_test/ref_scalar.cdl tmp_rescale_zarr_${zext}.cdl
|
2022-09-04 04:57:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
testcase file
|
|
|
|
if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testcase zip; fi
|
|
|
|
if test "x$FEATURE_S3TESTS" = xyes ; then testcase s3; fi
|