mirror of https://github.com/ecmwf/eccodes.git
Tests: clean up temp data. Remove dependencies between tests (a test should not depend on another one having been run before)
This commit is contained in:
parent
a67d5a66de
commit
27209d52cc
|
@ -19,6 +19,9 @@ infile=${data_dir}/reduced_gaussian_model_level.grib1
|
|||
outfile=${data_dir}/with_bitmap.grib1
|
||||
outfile1=${data_dir}/without_bitmap.grib1
|
||||
|
||||
# Create the grib2 file from grib1
|
||||
${tools_dir}grib_set -s editionNumber=2 $grib1 $grib2 2> $REDIRECT > $REDIRECT
|
||||
|
||||
rm -f $outfile || true
|
||||
|
||||
${tools_dir}grib_set -s bitmapPresent=1 $infile $outfile >$REDIRECT
|
||||
|
@ -59,5 +62,5 @@ ${tools_dir}grib_get_data -m missing out.grib2 > out.grib2.data
|
|||
diff out.grib1.data out.grib2.data
|
||||
|
||||
rm -f out.grib1.data out.grib2.data out.grib1 out.grib2 bitmap.rules
|
||||
|
||||
rm -f $grib2
|
||||
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
files="regular_latlon_surface.grib2 \
|
||||
regular_latlon_surface.grib1"
|
||||
|
||||
# Create the grib2 file from grib1
|
||||
${tools_dir}grib_set -s editionNumber=2 ${data_dir}/regular_latlon_surface.grib1 ${data_dir}/regular_latlon_surface.grib2
|
||||
|
||||
|
||||
for file in `echo $files`; do
|
||||
|
||||
infile=${data_dir}/$file
|
||||
|
@ -33,3 +37,4 @@ done
|
|||
# Extra test for grid_complex_spatial_differencing
|
||||
${tools_dir}grib_get -p decimalScaleFactor,bitsPerValue ${data_dir}/gfs.c255.grib2 > /dev/null
|
||||
|
||||
rm -f ${data_dir}/regular_latlon_surface.grib2
|
||||
|
|
|
@ -68,6 +68,7 @@ EOF
|
|||
${tools_dir}grib_get_data -F "%g" ${data_dir}/scan.grib > ${data_dir}/scan_y_${gridType}_${Ni}_${Nj}.dump
|
||||
diff ${data_dir}/scan_y_${gridType}_${Ni}_${Nj}.dump ${data_dir}/scan_y_${gridType}_${Ni}_${Nj}_good.dump
|
||||
rm -f ${data_dir}/scan_y_${gridType}_${Ni}_${Nj}.dump
|
||||
rm -f ${data_dir}/change_scanning_${gridType}.filter
|
||||
|
||||
done
|
||||
done
|
||||
|
|
|
@ -22,3 +22,4 @@ ${tools_dir}grib_set -s shortName=2d $infile $outfile
|
|||
|
||||
${tools_dir}grib_compare -b indicatorOfParameter,paramId,shortName $infile $outfile > $REDIRECT
|
||||
|
||||
rm -f $outfile || true
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
|
||||
|
||||
. ./include.sh
|
||||
|
||||
REDIRECT=/dev/null
|
||||
|
@ -17,24 +15,20 @@ REDIRECT=/dev/null
|
|||
files="regular_latlon_surface.grib2 \
|
||||
regular_latlon_surface.grib1"
|
||||
|
||||
# First create the necessary grib2 files
|
||||
${tools_dir}grib_set -s editionNumber=2 ${data_dir}/regular_latlon_surface.grib1 ${data_dir}/regular_latlon_surface.grib2
|
||||
|
||||
for file in `echo $files`
|
||||
do
|
||||
|
||||
infile=${data_dir}/$file
|
||||
outfile1=${infile}_decimalPrecision_1
|
||||
outfile2=${infile}_decimalPrecision_2
|
||||
|
||||
${tools_dir}grib_set -r -s decimalScaleFactor=1,bitsPerValue=0 $infile $outfile1
|
||||
|
||||
${tools_dir}grib_compare -b totalLength,section4Length,section7Length,dataLength,decimalScaleFactor,binaryScaleFactor,referenceValue,bitsPerValue $infile $outfile1 > $REDIRECT
|
||||
|
||||
${tools_dir}grib_set -s changeDecimalPrecision=1 $infile $outfile2
|
||||
|
||||
${tools_dir}grib_compare -b totalLength,section4Length,section7Length,dataLength,decimalScaleFactor,binaryScaleFactor,referenceValue,bitsPerValue $infile $outfile2 > $REDIRECT
|
||||
|
||||
${tools_dir}grib_compare $outfile1 $outfile2
|
||||
|
||||
rm -f $outfile1 $outfile2 || true
|
||||
|
||||
infile=${data_dir}/$file
|
||||
outfile1=${infile}_decimalPrecision_1
|
||||
outfile2=${infile}_decimalPrecision_2
|
||||
${tools_dir}grib_set -r -s decimalScaleFactor=1,bitsPerValue=0 $infile $outfile1
|
||||
${tools_dir}grib_compare -b totalLength,section4Length,section7Length,dataLength,decimalScaleFactor,binaryScaleFactor,referenceValue,bitsPerValue $infile $outfile1 > $REDIRECT
|
||||
${tools_dir}grib_set -s changeDecimalPrecision=1 $infile $outfile2
|
||||
${tools_dir}grib_compare -b totalLength,section4Length,section7Length,dataLength,decimalScaleFactor,binaryScaleFactor,referenceValue,bitsPerValue $infile $outfile2 > $REDIRECT
|
||||
${tools_dir}grib_compare $outfile1 $outfile2
|
||||
rm -f $outfile1 $outfile2 || true
|
||||
done
|
||||
|
||||
rm -f ${data_dir}/regular_latlon_surface.grib2
|
||||
|
|
|
@ -29,6 +29,7 @@ EOF
|
|||
${tools_dir}grib_filter ${data_dir}/f.rules ${data_dir}/tigge_pf_ecmwf.grib2 2> $REDIRECT > $REDIRECT
|
||||
|
||||
rm -f ${data_dir}/split/*
|
||||
rm -f ${data_dir}/f.rules
|
||||
|
||||
# Test with nonexistent keys. Note spelling of centre!
|
||||
#######################################################
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
|
||||
. ./include.sh
|
||||
|
||||
REDIRECT=/dev/null
|
||||
|
@ -32,25 +31,22 @@ files="constant_field\
|
|||
|
||||
for f in `echo $files`
|
||||
do
|
||||
file=${data_dir}/$f
|
||||
g2file=${file}.grib2_
|
||||
rm -f $g2file || true
|
||||
${tools_dir}grib_set -s editionNumber=2 ${file}.grib1 ${g2file} 2> $REDIRECT > $REDIRECT
|
||||
|
||||
file=${data_dir}/$f
|
||||
grib1Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${file}.grib1`
|
||||
grib2Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${g2file}`
|
||||
|
||||
rm -f ${file}.grib2 || true
|
||||
|
||||
${tools_dir}grib_set -s editionNumber=2 ${file}.grib1 ${file}.grib2 2> $REDIRECT > $REDIRECT
|
||||
|
||||
|
||||
grib1Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${file}.grib1`
|
||||
grib2Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${file}.grib2`
|
||||
|
||||
if [ "$grib1Statistics" != "$grib2Statistics" ]
|
||||
then
|
||||
if [ "$grib1Statistics" != "$grib2Statistics" ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#${tools_dir}grib_compare -A1.0e-8 -c values ${file}.grib1 ${file}.grib2 2> /dev/null > /dev/null
|
||||
${tools_dir}grib_compare -P -c values ${file}.grib1 ${file}.grib2 2> $REDIRECT > $REDIRECT
|
||||
fi
|
||||
|
||||
#${tools_dir}grib_compare -A1.0e-8 -c values ${file}.grib1 ${g2file} 2> /dev/null > /dev/null
|
||||
${tools_dir}grib_compare -P -c values ${file}.grib1 ${g2file} 2> $REDIRECT > $REDIRECT
|
||||
rm -f ${g2file} || true
|
||||
done
|
||||
|
||||
#sed "s:toolsdir:${tools_dir}:" ${tools_dir}grib1to2.txt > ${tools_dir}grib1to2.test
|
||||
|
|
|
@ -32,8 +32,12 @@ files="constant_field\
|
|||
for f in `echo $files`
|
||||
do
|
||||
file=${data_dir}/$f
|
||||
rm -f ${file}.grib1_ || true
|
||||
|
||||
# First create the grib2 file
|
||||
rm -f ${file}.grib2 || true
|
||||
${tools_dir}grib_set -s editionNumber=2 ${file}.grib1 ${file}.grib2 2> $REDIRECT > $REDIRECT
|
||||
|
||||
rm -f ${file}.grib1_ || true
|
||||
${tools_dir}grib_set -s editionNumber=1 ${file}.grib2 ${file}.grib1_ 2> $REDIRECT > $REDIRECT
|
||||
|
||||
grib1Statistics=`${tools_dir}grib_get -fp numberOfValues,numberOfPoints,max,min,average,numberOfMissing ${file}.grib1_`
|
||||
|
@ -46,6 +50,7 @@ do
|
|||
|
||||
#${tools_dir}grib_compare -A1.0e-8 -c values ${file}.grib1_ ${file}.grib2 2> /dev/null > /dev/null
|
||||
rm -f ${file}.grib1_ || true
|
||||
rm -f ${file}.grib2 || true
|
||||
done
|
||||
|
||||
# GRIB-262 Conversion works without error for L137 data
|
||||
|
|
|
@ -35,7 +35,6 @@ fi
|
|||
echo "NetCDF was enabled."
|
||||
|
||||
grib_files="\
|
||||
set.grib2 set.grib1 \
|
||||
regular_latlon_surface.grib2 \
|
||||
regular_latlon_surface.grib1 \
|
||||
regular_gaussian_model_level.grib1 \
|
||||
|
|
|
@ -71,5 +71,5 @@ export GRIB_IEEE_PACKING
|
|||
#${tools_dir}grib_filter r.filter ${shdata}_64 > ${shdata}_64.txt
|
||||
#diff ${shdata}_64.txt ${shdata}.good
|
||||
|
||||
rm -f r.filter ${shdata}_64.txt ${shdata}_32.txt
|
||||
rm -f r.filter ${shdata}_64.txt ${shdata}_32.txt $shdata.txt
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
|
||||
. ./include.sh
|
||||
|
||||
files="reduced_latlon_surface.grib1 \
|
||||
|
@ -22,15 +21,33 @@ files="reduced_latlon_surface.grib1 \
|
|||
reduced_gaussian_sub_area.grib2 \
|
||||
regular_latlon_surface.grib2"
|
||||
|
||||
for f in `echo $files`
|
||||
do
|
||||
|
||||
file=${data_dir}/$f
|
||||
|
||||
iterator_count=`${tools_dir}grib_get_data -m 9999:missing -f -p centre -F "%g" -w count=1 $file | grep -v Lat |wc -l `
|
||||
numberOfPoints=`${tools_dir}grib_get -w count=1 -p numberOfPoints $file`
|
||||
|
||||
[ $numberOfPoints = ${iterator_count} ]
|
||||
|
||||
# First create the necessary grib2 files from grib1
|
||||
files2conv="\
|
||||
reduced_latlon_surface\
|
||||
reduced_gaussian_pressure_level\
|
||||
regular_gaussian_pressure_level\
|
||||
reduced_gaussian_sub_area\
|
||||
regular_latlon_surface\
|
||||
"
|
||||
for f in $files2conv; do
|
||||
${tools_dir}grib_set -s editionNumber=2 ${data_dir}/$f.grib1 ${data_dir}/$f.grib2
|
||||
done
|
||||
|
||||
# First create the necessary grib2 files
|
||||
#${tools_dir}grib_set -s editionNumber=2 ${data_dir}/reduced_latlon_surface.grib1 ${data_dir}/reduced_latlon_surface.grib2
|
||||
#${tools_dir}grib_set -s editionNumber=2 ${data_dir}/reduced_gaussian_pressure_level.grib1 ${data_dir}/reduced_gaussian_pressure_level.grib2
|
||||
#${tools_dir}grib_set -s editionNumber=2 ${data_dir}/regular_gaussian_pressure_level.grib1 ${data_dir}/regular_gaussian_pressure_level.grib2
|
||||
#${tools_dir}grib_set -s editionNumber=2 ${data_dir}/reduced_gaussian_sub_area.grib1 ${data_dir}/reduced_gaussian_sub_area.grib2
|
||||
|
||||
for f in `echo $files`
|
||||
do
|
||||
file=${data_dir}/$f
|
||||
iterator_count=`${tools_dir}grib_get_data -m 9999:missing -f -p centre -F "%g" -w count=1 $file | grep -v Lat |wc -l `
|
||||
numberOfPoints=`${tools_dir}grib_get -w count=1 -p numberOfPoints $file`
|
||||
[ $numberOfPoints = ${iterator_count} ]
|
||||
done
|
||||
|
||||
# Clean up
|
||||
for f in $files2conv; do
|
||||
rm -f ${data_dir}/$f.grib2
|
||||
done
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
|
||||
. ./include.sh
|
||||
|
||||
REDIRECT=/dev/null
|
||||
|
@ -34,6 +33,8 @@ fi
|
|||
rm -f $infile.1 $infile.2 || true
|
||||
|
||||
infile=${data_dir}/reduced_latlon_surface.grib2
|
||||
# Create the grib2 file from grib1
|
||||
${tools_dir}grib_set -s editionNumber=2 ${data_dir}/reduced_latlon_surface.grib1 ${data_dir}/reduced_latlon_surface.grib2
|
||||
|
||||
${tools_dir}grib_set -s packingType=grid_jpeg $infile $infile.1
|
||||
${tools_dir}grib_compare -P -b $BLACKLIST $infile $infile.1 > $REDIRECT
|
||||
|
@ -47,3 +48,4 @@ res3=`${tools_dir}grib_get '-F%1.2f' -p min,max,avg $infile.2`
|
|||
[ "$res1" = "$res3" ]
|
||||
|
||||
rm -f $infile.1 $infile.2 || true
|
||||
rm -f ${data_dir}/reduced_latlon_surface.grib2
|
||||
|
|
|
@ -10,9 +10,13 @@
|
|||
. ./include.sh
|
||||
#set -x
|
||||
|
||||
GRIB_INFILE=${data_dir}/regular_gaussian_pressure_level_constant.grib2
|
||||
GRIB1_INFILE=${data_dir}/regular_gaussian_pressure_level_constant.grib1
|
||||
GRIB2_INFILE=${data_dir}/regular_gaussian_pressure_level_constant.grib2
|
||||
REF_FILE=lamb_az_eq_area.ref
|
||||
|
||||
# First create the grib2 file from grib1
|
||||
${tools_dir}grib_set -s editionNumber=2 $GRIB1_INFILE $GRIB2_INFILE
|
||||
|
||||
# Temporary files created for this test
|
||||
FILTER_FILE=lamb_az_eq_area.filter
|
||||
GRIB_OUTFILE=lamb_az_eq_area.grib2
|
||||
|
@ -41,7 +45,7 @@ write "lamb_az_eq_area.grib2";
|
|||
EOF
|
||||
|
||||
# Use this filter and the input GRIB to create a new GRIB
|
||||
${tools_dir}grib_filter $FILTER_FILE $GRIB_INFILE
|
||||
${tools_dir}grib_filter $FILTER_FILE $GRIB2_INFILE
|
||||
if [ ! -f "$GRIB_OUTFILE" ]; then
|
||||
echo Failed to create output GRIB from filter >&2
|
||||
exit 1
|
||||
|
@ -53,5 +57,5 @@ ${tools_dir}grib_get_data $GRIB_OUTFILE > $DATA_OUTFILE
|
|||
diff $DATA_OUTFILE $REF_FILE
|
||||
|
||||
# Clean up
|
||||
rm -f $FILTER_FILE $GRIB_OUTFILE $DATA_OUTFILE
|
||||
rm -f $FILTER_FILE $GRIB_OUTFILE $DATA_OUTFILE $GRIB2_INFILE
|
||||
|
||||
|
|
|
@ -21,8 +21,13 @@ set scaledValueOfCentralWaveNumber={26870,9272,8377,22334};
|
|||
write "test.grib";
|
||||
EOF
|
||||
|
||||
file="${data_dir}/reduced_gaussian_model_level.grib2"
|
||||
# First create the grib2 file from grib1
|
||||
gname=reduced_gaussian_model_level
|
||||
grib1File=${data_dir}/${gname}.grib1
|
||||
grib2File=${data_dir}/${gname}.grib2
|
||||
${tools_dir}grib_set -s editionNumber=2 $grib1File $grib2File
|
||||
|
||||
file="$grib2File"
|
||||
${tools_dir}grib_filter list.filter $file
|
||||
|
||||
cat >list.filter<<EOF
|
||||
|
@ -49,5 +54,4 @@ EOF
|
|||
|
||||
diff x.out list.ref
|
||||
|
||||
rm -f x.out list.ref list.filter test.grib
|
||||
|
||||
rm -f x.out list.ref list.filter test.grib $grib2File
|
||||
|
|
27
tests/ls.sh
27
tests/ls.sh
|
@ -8,7 +8,6 @@
|
|||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
|
||||
. ./include.sh
|
||||
|
||||
rm -f log | true
|
||||
|
@ -50,6 +49,27 @@ regular_latlon_surface.grib1
|
|||
regular_latlon_surface.grib2
|
||||
"
|
||||
|
||||
# First create the necessary grib2 files
|
||||
files2conv="\
|
||||
reduced_gaussian_model_level\
|
||||
reduced_gaussian_pressure_level\
|
||||
reduced_gaussian_model_level\
|
||||
reduced_gaussian_pressure_level\
|
||||
reduced_gaussian_pressure_level_constant\
|
||||
reduced_gaussian_sub_area\
|
||||
reduced_gaussian_surface\
|
||||
reduced_latlon_surface\
|
||||
regular_gaussian_model_level\
|
||||
regular_gaussian_pressure_level\
|
||||
regular_gaussian_pressure_level_constant\
|
||||
regular_gaussian_surface\
|
||||
regular_latlon_surface\
|
||||
"
|
||||
for f in $files2conv; do
|
||||
rm -f $f.grib2 || true
|
||||
${tools_dir}grib_set -s editionNumber=2 $f.grib1 $f.grib2
|
||||
done
|
||||
|
||||
for file in $files
|
||||
do
|
||||
[ -f "$file" ]
|
||||
|
@ -76,5 +96,10 @@ fi
|
|||
# GRIB-387 printing key of type byte
|
||||
${tools_dir}grib_ls -p uuidOfVGrid test_uuid.grib2 > /dev/null
|
||||
|
||||
# Clean up
|
||||
for f in $files2conv; do
|
||||
rm -f $f.grib2
|
||||
done
|
||||
|
||||
cd $workdir
|
||||
|
||||
|
|
|
@ -82,3 +82,4 @@ test_data
|
|||
${tools_dir}grib_dump second_ord_rbr.grib1 > $REDIRECT
|
||||
|
||||
|
||||
rm -f test.filter
|
||||
|
|
12
tests/set.sh
12
tests/set.sh
|
@ -8,7 +8,6 @@
|
|||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
|
||||
. ./include.sh
|
||||
|
||||
REDIRECT=/dev/null
|
||||
|
@ -32,7 +31,14 @@ levtype=`${tools_dir}grib_get -p levtype:l $outfile`
|
|||
centre=`${tools_dir}grib_get -p centre:l $outfile`
|
||||
[ $centre -eq 80 ]
|
||||
|
||||
infile=${data_dir}/regular_gaussian_surface.grib2
|
||||
rm -f $outfile || true
|
||||
|
||||
# Create the grib2 file from grib1
|
||||
grib1File=${data_dir}/regular_gaussian_surface.grib1
|
||||
grib2File=${data_dir}/regular_gaussian_surface.grib2
|
||||
${tools_dir}grib_set -s editionNumber=2 $grib1File $grib2File
|
||||
|
||||
infile=$grib2File
|
||||
outfile=${data_dir}/set.grib2
|
||||
|
||||
rm -f $outfile || true
|
||||
|
@ -57,4 +63,4 @@ ${tools_dir}grib_set -p levtype $infile $outfile 2> $REDIRECT > $REDIRECT
|
|||
|
||||
[ $? -ne 0 ]
|
||||
|
||||
|
||||
rm -f $outfile $grib2File || true
|
||||
|
|
|
@ -56,7 +56,13 @@ rm -f ${data_dir}/log | true
|
|||
|
||||
# GRIB-180
|
||||
# Set PDT 4.8 where you can find the EndOfOverallTimeInterval keys
|
||||
grib2File=${data_dir}/reduced_latlon_surface_constant.grib2
|
||||
# First create the necessary grib2 file
|
||||
gname=reduced_latlon_surface_constant
|
||||
grib1File=${data_dir}/${gname}.grib1
|
||||
grib2File=${data_dir}/${gname}.grib2
|
||||
rm -f $grib2File || true
|
||||
${tools_dir}grib_set -s editionNumber=2 $grib1File $grib2File
|
||||
|
||||
${tools_dir}grib_set -sproductDefinitionTemplateNumber=8 $grib2File ${grib2File}.p8tmp
|
||||
|
||||
# 78 hours is 3 days and 6 hours
|
||||
|
@ -73,4 +79,4 @@ hourEnd=$1; dayEnd=$2
|
|||
[ "$dayEnd" = "6" ]
|
||||
|
||||
rm -f $grib2File.p8tmp ${grib2File}.tmp | true
|
||||
|
||||
rm -f $grib2File
|
||||
|
|
Loading…
Reference in New Issue