o ncdump.c: set PRINTF_EXPONENT_DIGITS=2 when in windows to control the number of digits in the exponent.

o *.sh: Added stanza's to ensure that srcdir is set if it's not already set.
This commit is contained in:
Ward Fisher 2012-05-08 22:37:56 +00:00
parent 9fc359f29b
commit 08c29d0f06
5 changed files with 44 additions and 27 deletions

View File

@ -2312,6 +2312,10 @@ main(int argc, char *argv[])
boolean xml_out = false; /* if true, output NcML instead of CDL */ boolean xml_out = false; /* if true, output NcML instead of CDL */
boolean kind_out = false; /* if true, just output kind of netCDF file */ boolean kind_out = false; /* if true, just output kind of netCDF file */
#if defined(WIN32) || defined(msdos)
putenv("PRINTF_EXPONENT_DIGITS=2"); /* Enforce unix/linux style exponent formatting. */
#endif
#ifdef HAVE_LOCALE_H #ifdef HAVE_LOCALE_H
setlocale(LC_ALL, "C"); /* CDL may be ambiguous with other locales */ setlocale(LC_ALL, "C"); /* CDL may be ambiguous with other locales */
#endif /* HAVE_LOCALE_H */ #endif /* HAVE_LOCALE_H */

View File

@ -2,6 +2,10 @@
# For a netCDF-3 build, test nccopy on netCDF files in this directory # For a netCDF-3 build, test nccopy on netCDF files in this directory
set -e set -e
if test "x$srcdir" = "x"; then
srcdir=`dirname $0`;
export srcdir=$srcdir
fi
echo "" echo ""
TESTFILES='c0 c0tmp ctest0 ctest0_64 small small2 test0 test1 TESTFILES='c0 c0tmp ctest0 ctest0_64 small small2 test0 test1
@ -9,13 +13,13 @@ TESTFILES='c0 c0tmp ctest0 ctest0_64 small small2 test0 test1
echo "*** Testing netCDF-3 features of nccopy on ncdump/*.nc files" echo "*** Testing netCDF-3 features of nccopy on ncdump/*.nc files"
for i in $TESTFILES ; do for i in $TESTFILES ; do
echo "*** copy $i.nc to copy_of_$i.nc ..." echo "*** copy $i.nc to copy_$i.nc ..."
./nccopy $i.nc copy_of_$i.nc ./nccopy $i.nc copy_$i.nc
./ncdump -n copy_of_$i $i.nc > tmp.cdl ./ncdump -n copy_$i $i.nc > tmp.cdl
./ncdump copy_of_$i.nc > copy_of_$i.cdl ./ncdump copy_$i.nc > copy_$i.cdl
echo "*** compare " with copy_of_$i.cdl echo "*** compare " with copy_$i.cdl
diff -b copy_of_$i.cdl tmp.cdl diff -b copy_$i.cdl tmp.cdl
rm copy_of_$i.nc copy_of_$i.cdl tmp.cdl rm copy_$i.nc copy_$i.cdl tmp.cdl
done done
echo "*** Test nccopy -u" echo "*** Test nccopy -u"
echo "*** creating tst_brecs.nc from tst_brecs.cdl..." echo "*** creating tst_brecs.nc from tst_brecs.cdl..."

View File

@ -14,13 +14,13 @@ TESTFILES='tst_comp tst_comp2 tst_enum_data tst_fillbug
echo "*** Testing netCDF-4 features of nccopy on ncdump/*.nc files" echo "*** Testing netCDF-4 features of nccopy on ncdump/*.nc files"
for i in $TESTFILES ; do for i in $TESTFILES ; do
echo "*** copy $i.nc to copy_of_$i.nc ..." echo "*** copy $i.nc to $i_copy.nc ..."
./nccopy $i.nc copy_of_$i.nc ./nccopy "$i.nc" "$i_copy.nc"
./ncdump -n copy_of_$i $i.nc > tmp.cdl ./ncdump -n "$i_copy" "$i.nc" > tmp.cdl
./ncdump copy_of_$i.nc > copy_of_$i.cdl ./ncdump "$i_copy.nc" > "$i_copy.cdl"
echo "*** compare " with copy_of_$i.cdl echo "*** compare " with "$i_copy.cdl"
diff -b copy_of_$i.cdl tmp.cdl diff "$i_copy.cdl" tmp.cdl
rm copy_of_$i.nc copy_of_$i.cdl tmp.cdl rm "$i_copy.nc" "$i_copy.cdl" tmp.cdl
done done
echo "*** Create deflatable files for testing ..." echo "*** Create deflatable files for testing ..."
./tst_compress ./tst_compress
@ -48,13 +48,13 @@ rm tst_deflated.nc tst_inflated.nc tst_inflated4.nc tmp.nc
echo "*** Testing nccopy -d1 -s on ncdump/*.nc files" echo "*** Testing nccopy -d1 -s on ncdump/*.nc files"
for i in $TESTFILES ; do for i in $TESTFILES ; do
echo "*** nccopy -d1 -s $i.nc copy_of_$i.nc ..." echo "*** nccopy -d1 -s $i.nc $i_copy.nc ..."
./nccopy -d1 -s $i.nc copy_of_$i.nc ./nccopy -d1 -s "$i.nc" "$i_copy.nc"
./ncdump -n copy_of_$i $i.nc > tmp.cdl ./ncdump -n "$i_copy" "$i.nc" > tmp.cdl
./ncdump copy_of_$i.nc > copy_of_$i.cdl ./ncdump "$i_copy.nc" > "$i_copy.cdl"
echo "*** compare " with copy_of_$i.cdl echo "*** compare " with "$i_copy.cdl"
diff -b copy_of_$i.cdl tmp.cdl diff "$i_copy.cdl" tmp.cdl
rm copy_of_$i.nc copy_of_$i.cdl tmp.cdl rm "$i_copy.nc" "$i_copy.cdl" tmp.cdl
done done
echo "*** Create chunkable file for testing ..." echo "*** Create chunkable file for testing ..."
./tst_chunking ./tst_chunking
@ -63,10 +63,10 @@ echo "*** Test that nccopy -c can chunk and unchunk files"
./ncdump tmp.nc > tmp.cdl ./ncdump tmp.nc > tmp.cdl
./nccopy -c dim0/,dim1/1,dim2/,dim3/1,dim4/,dim5/1,dim6/ tst_chunking.nc tmp-chunked.nc ./nccopy -c dim0/,dim1/1,dim2/,dim3/1,dim4/,dim5/1,dim6/ tst_chunking.nc tmp-chunked.nc
./ncdump -n tmp tmp-chunked.nc > tmp-chunked.cdl ./ncdump -n tmp tmp-chunked.nc > tmp-chunked.cdl
diff -b tmp.cdl tmp-chunked.cdl diff tmp.cdl tmp-chunked.cdl
./nccopy -c dim0/,dim1/,dim2/,dim3/,dim4/,dim5/,dim6/ tmp-chunked.nc tmp-unchunked.nc ./nccopy -c dim0/,dim1/,dim2/,dim3/,dim4/,dim5/,dim6/ tmp-chunked.nc tmp-unchunked.nc
./ncdump -n tmp tmp-unchunked.nc > tmp-unchunked.cdl ./ncdump -n tmp tmp-unchunked.nc > tmp-unchunked.cdl
diff -b tmp.cdl tmp-unchunked.cdl diff tmp.cdl tmp-unchunked.cdl
# echo "*** Test that nccopy compression with chunking can improve compression" # echo "*** Test that nccopy compression with chunking can improve compression"
rm tst_chunking.nc tmp.nc tmp.cdl tmp-chunked.nc tmp-chunked.cdl tmp-unchunked.nc tmp-unchunked.cdl rm tst_chunking.nc tmp.nc tmp.cdl tmp-chunked.nc tmp-chunked.cdl tmp-unchunked.nc tmp-unchunked.cdl

View File

@ -3,6 +3,11 @@
# $Id: tst_netcdf4.sh,v 1.34 2009/09/25 18:22:10 dmh Exp $ # $Id: tst_netcdf4.sh,v 1.34 2009/09/25 18:22:10 dmh Exp $
set -e set -e
if test "x$srcdir" = "x"; then
srcdir=`dirname $0`;
fi
export srcdir=$srcdir
echo "" echo ""
echo "*** Testing ncgen and ncdump test output for netCDF-4 format." echo "*** Testing ncgen and ncdump test output for netCDF-4 format."
echo "*** creating netcdf-4 file c0.nc from c0.cdl..." echo "*** creating netcdf-4 file c0.nc from c0.cdl..."
@ -36,7 +41,7 @@ echo "*** dumping tst_group_data.nc to tst_group_data.cdl..."
echo "*** comparing tst_group_data.cdl with ref_tst_group_data.cdl..." echo "*** comparing tst_group_data.cdl with ref_tst_group_data.cdl..."
diff -b tst_group_data.cdl $srcdir/ref_tst_group_data.cdl diff -b tst_group_data.cdl $srcdir/ref_tst_group_data.cdl
echo "*** testing -v option with absolute name and groups..." echo "*** testing -v option with absolute name and groups..."
./ncdump -v /g2/g3/var tst_group_data.nc > tst_group_data.cdl ./ncdump -v var tst_group_data.nc > tst_group_data.cdl
echo "*** comparing tst_group_data.cdl with ref_tst_group_data_v23.cdl..." echo "*** comparing tst_group_data.cdl with ref_tst_group_data_v23.cdl..."
diff -b tst_group_data.cdl $srcdir/ref_tst_group_data_v23.cdl diff -b tst_group_data.cdl $srcdir/ref_tst_group_data_v23.cdl
echo "*** testing -v option with relative name and groups..." echo "*** testing -v option with relative name and groups..."

View File

@ -3,6 +3,10 @@
# $Id: tst_netcdf4_4.sh,v 1.13 2009/05/06 14:51:52 ed Exp $ # $Id: tst_netcdf4_4.sh,v 1.13 2009/05/06 14:51:52 ed Exp $
set -e set -e
if test "x$srcdir" = "x"; then
srcdir=`dirname $0`;
export srcdir=$srcdir
fi
echo "" echo ""
echo "*** Running extra netcdf-4 tests." echo "*** Running extra netcdf-4 tests."
@ -15,15 +19,15 @@ diff -b tst_string_data.cdl $srcdir/ref_tst_string_data.cdl
#../ncgen/ncgen -v4 -b -o tst_noncoord.nc $srcdir/ref_tst_noncoord.cdl #../ncgen/ncgen -v4 -b -o tst_noncoord.nc $srcdir/ref_tst_noncoord.cdl
echo '*** testing reference file ref_tst_compounds2.nc...' echo '*** testing reference file ref_tst_compounds2.nc...'
./ncdump $srcdir/ref_tst_compounds2.nc > tst_compounds2.cdl ./ncdump ref_tst_compounds2.nc > tst_compounds2.cdl
diff -b tst_compounds2.cdl $srcdir/ref_tst_compounds2.cdl diff -b tst_compounds2.cdl $srcdir/ref_tst_compounds2.cdl
echo '*** testing reference file ref_tst_compounds3.nc...' echo '*** testing reference file ref_tst_compounds3.nc...'
./ncdump $srcdir/ref_tst_compounds3.nc > tst_compounds3.cdl ./ncdump ref_tst_compounds3.nc > tst_compounds3.cdl
diff -b tst_compounds3.cdl $srcdir/ref_tst_compounds3.cdl diff -b tst_compounds3.cdl $srcdir/ref_tst_compounds3.cdl
echo '*** testing reference file ref_tst_compounds4.nc...' echo '*** testing reference file ref_tst_compounds4.nc...'
./ncdump $srcdir/ref_tst_compounds4.nc > tst_compounds4.cdl ./ncdump ref_tst_compounds4.nc > tst_compounds4.cdl
diff -b tst_compounds4.cdl $srcdir/ref_tst_compounds4.cdl diff -b tst_compounds4.cdl $srcdir/ref_tst_compounds4.cdl
echo echo