netcdf-c/nczarr_test/test_nczarr.sh
Dennis Heimbigner eb3d9eb0c9 Provide a Number of fixes/improvements to NCZarr
Primary changes:
* Add an improved cache system to speed up performance.
* Fix NCZarr to properly handle scalar variables.

Misc. Related Changes:
* Added unit tests for extendible hash and for the generic cache.
* Add config parameter to set size of the NCZarr cache.
* Add initial performance tests but leave them unused.
* Add CRC64 support.
* Move location of ncdumpchunks utility from /ncgen to /ncdump.
* Refactor auth support.

Misc. Unrelated Changes:
* More cleanup of the S3 support
* Add support for S3 authentication in .rc files: HTTP.S3.ACCESSID and HTTP.S3.SECRETKEY.
* Remove the hashkey from the struct OBJHDR since it is never used.
2020-11-19 17:01:04 -07:00

102 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
if test "x$SETX" != x; then set -x; fi
# Check settings
checksetting() {
if test -f ${TOPBUILDDIR}/libnetcdf.settings ; then
local PATTERN
PATTERN="${1}:[ ]*yes"
if grep "$PATTERN" <${TOPBUILDDIR}/libnetcdf.settings ; then
HAVE_SETTING=1
else
unset HAVE_SETTING
fi
fi
}
extfor() {
case "$1" in
nc4) zext="nz4" ;;
nz4) zext="nz4" ;;
nzf) zext="nzf" ;;
s3) zext="s3" ;;
*) echo "unknown kind: $1" ; exit 1;;
esac
}
deletemap() {
case "$1" in
nc4) rm -fr $2;;
nz4) rm -fr $2;;
nzf) rm -fr $2;;
esac
}
mapexists() {
mapexists=1
case "$1" in
nz4) if test -f $file; then mapexists=0; fi ;;
nzf) if test -f $file; then mapexists=0; fi ;;
s3)
if "./zmapio $fileurl" ; then mapexists=1; else mapexists=0; fi
;;
*) echo unknown format: $1 : abort ; exit 1 ;;
esac
if test $mapexists = 1 ; then
echo "delete did not delete $1"
fi
}
fileargs() {
if test "x$zext" = xs3 ; then
if test "x$NCS3PATH" = x ; then
S3PATH="https://stratus.ucar.edu/unidata-netcdf-zarr-testing"
else
S3PATH="${NCS3PATH}"
fi
fileurl="${S3PATH}/test$tag#mode=nczarr,$zext"
file=$fileurl
S3HOST=`${execdir}/zs3parse -h $S3PATH`
S3BUCKET=`${execdir}/zs3parse -b $S3PATH`
S3PREFIX=`${execdir}/zs3parse -p $S3PATH`
else
file="test$tag.$zext"
fileurl="file://test$tag.$zext#mode=nczarr,$zext"
fi
}
dumpmap1() {
local ISJSON
tmp=
if test -f $1 ; then
ISJSON=`${execdir}/zisjson <$1`
if test "x$ISJSON" = x1 ; then
tmp=`tr '\r\n' ' ' <$1`
else
tmp=`${execdir}/zhex <$1`
fi
echo "$1 : |$tmp|" >> $2
else
echo "$1" >> $2
fi
}
dumpmap() {
case "$1" in
nz4) rm -f $3 ; ${NCDUMP} $2 > $3 ;;
nzf)
rm -f $3
export LC_ALL=C
lr=`find $2 | sort| tr '\r\n' ' '`
for f in $lr ; do dumpmap1 $f $3 ; done
;;
s3)
aws s3api list-objects --endpoint-url=$S3HOST --bucket=$S3BUCKET
;;
*) echo "dumpmap failed" ; exit 1;
esac
}
ZMD="${execdir}/zmapio"