Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mannreis committed Dec 17, 2024
1 parent 7ddd7c9 commit c20aec1
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 1 deletion.
3 changes: 3 additions & 0 deletions libnczarr/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ zgrp.c \
zinternal.c \
zmap.c \
zmap_file.c \
zmetadata2.c \
zmetadata.c \
zodom.c \
zopen.c \
zprov.c \
Expand All @@ -59,6 +61,7 @@ zdispatch.h \
zincludes.h \
zinternal.h \
zmap.h \
zmetadata.h \
zodom.h \
zprovenance.h \
zplugins.h \
Expand Down
3 changes: 3 additions & 0 deletions nczarr_test/ref_consolidated_zarr_2.18.2_python.zarr/.zattrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Description": "Consolidated zarr test"
}
3 changes: 3 additions & 0 deletions nczarr_test/ref_consolidated_zarr_2.18.2_python.zarr/.zgroup
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
67 changes: 67 additions & 0 deletions nczarr_test/ref_consolidated_zarr_2.18.2_python.zarr/.zmetadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"metadata": {
".zattrs": {
"Description": "Consolidated zarr test"
},
".zgroup": {
"zarr_format": 2
},
"G1/.zattrs": {
"Details": "Varibles are chunked"
},
"G1/.zgroup": {
"zarr_format": 2
},
"G1/subg1/.zgroup": {
"zarr_format": 2
},
"G1/subg1/myarray/.zarray": {
"chunks": [
6,
15
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<i4",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
6,
15
],
"zarr_format": 2
},
"G2/.zgroup": {
"zarr_format": 2
},
"G2/other variable with spaces/.zarray": {
"chunks": [
3,
5
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<i8",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
3,
5
],
"zarr_format": 2
}
},
"zarr_consolidated_format": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Details": "Varibles are chunked"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"chunks": [
6,
15
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<i4",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
6,
15
],
"zarr_format": 2
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"chunks": [
3,
5
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<i8",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
3,
5
],
"zarr_format": 2
}
Binary file not shown.
21 changes: 20 additions & 1 deletion nczarr_test/run_consolidated_zarr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ cd $ISOPATH
testcase() {
zext=$1

set -x
echo "*** Test: consolidated zarr write then read; format=$zext"
fileargs tmp_consolidated_zarr "mode=zarr,noxarray,$zext"
deletemap $zext $file
${NCGEN} -4 -b -o "$fileurl" $srcdir/ref_consolidated_zarr_base.cdl
echo "${NCDUMP} $fileurl > tmp_consolidated_zarr_${zext}.cdl"
${NCDUMP} $fileurl > tmp_consolidated_zarr_${zext}.cdl
diff -b ${srcdir}/ref_consolidated_zarr.cdl tmp_consolidated_zarr_${zext}.cdl

Expand All @@ -42,7 +42,26 @@ testcase() {
diff -b ${srcdir}/ref_nczarr2zarr.cdl tmp_nczarr_${zext}.cdl
}

testcase_csl_vs_no(){
zext=$1

set -x
echo "*** Test: consolidated pure python zarr read; format=$zext"
deletemap $zext $file
cp -r $srcdir/ref_consolidated_zarr_2.18.2_python.zarr ref_consolidated_zarr_2.18.2_python.zarr.$zext
cp -r $srcdir/ref_consolidated_zarr_2.18.2_python.zarr ref_zarr_2.18.2_python.zarr.$zext
rm -f ref_zarr_2.18.2_python.zarr.$zext/.zmetadata
fileargs ref_consolidated_zarr_2.18.2_python.zarr "mode=zarr"
echo "${NCDUMP} $fileurl > tmp_consolidated_python_zarr_${zext}.cdl"
${NCDUMP} -n same_name $fileurl > tmp_consolidated_python_zarr_${zext}.cdl
fileargs ref_zarr_2.18.2_python.zarr "mode=zarr,$zext"
${NCDUMP} -n same_name $fileurl > tmp_python_zarr_${zext}.cdl
diff -b tmp_consolidated_python_zarr_${zext}.cdl tmp_python_zarr_${zext}.cdl
set +x
}

testcase file
testcase_csl_vs_no file
if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testcase zip; fi
if test "x$FEATURE_S3TESTS" = xyes ; then testcase s3; fi

0 comments on commit c20aec1

Please sign in to comment.