Testing: Cleanup

This commit is contained in:
Shahram Najm 2023-12-14 13:35:47 +00:00
parent 0d4b87b271
commit 9d4d83b0f8
7 changed files with 58 additions and 48 deletions

View File

@ -10,12 +10,12 @@
. ./include.ctest.sh
label="grib_calendar_test"
temp1=temp1.calendar.$$
temp2=temp2.calendar.$$
temp1=temp1.$label.$$
temp2=temp2.$label.$$
sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
${tools_dir}/grib_set -s tablesVersion=13,setCalendarId=1,typeOfCalendar=0 $sample $temp1
grib_check_key_equals $temp1 calendarIdPresent 1
grib_check_key_equals $temp1 section1Length 24

View File

@ -10,13 +10,13 @@
. ./include.ctest.sh
tmpdata=grib_multi.$$.grib
label="grib_multi_test"
tmpdata=temp.$label.$$.grib
rm -f $tmpdata
parameterNumber=`${tools_dir}/grib_get -p parameterNumber -w parameterCategory=2,parameterNumber=3 ${data_dir}/multi.grib2`
if [ -z "$parameterNumber" ]
then
echo ---------- grib_get failure
if [ -z "$parameterNumber" ]; then
echo '---------- grib_get failure'
exit 1
fi
@ -24,15 +24,14 @@ ${tools_dir}/grib_copy -w parameterCategory=2,parameterNumber=3 ${data_dir}/mult
${tools_dir}/grib_compare ${data_dir}/v.grib2 $tmpdata.1
cat > $tmpdata.rules <<EOF
if ( parameterCategory==2 && parameterNumber==3) {
print "[parameterNumber]";
}
if ( parameterCategory==2 && parameterNumber==3) {
print "[parameterNumber]";
}
EOF
parameterNumber=`${tools_dir}/grib_filter $tmpdata.rules ${data_dir}/multi.grib2`
if [ -z "$parameterNumber" ]
then
echo ---------- grib_filter failure
if [ -z "$parameterNumber" ]; then
echo '---------- grib_filter failure'
exit 1
fi

View File

@ -10,11 +10,13 @@
. ./include.ctest.sh
label="grib_padding_test"
REDIRECT=/dev/null
temp=loc.padding.grib1
tempGrib=temp.local.$label.grib1
tempFilt=temp.local.$label.filt
${tools_dir}/grib_set -s setLocalDefinition=1 ${data_dir}/regular_latlon_surface.grib1 $temp
cat > $$_f <<EOF
${tools_dir}/grib_set -s setLocalDefinition=1 ${data_dir}/regular_latlon_surface.grib1 $tempGrib
cat > $tempFilt <<EOF
if (GRIBEXSection1Problem ) {
print "localDefinitionNumber=[localDefinitionNumber] size(GRIBEX-section1)=[GRIBEXSection1Problem] section1Length=[section1Length]";
write "problem.grib";
@ -24,27 +26,32 @@ EOF
# Note: we cannot use -printf "%f\n" as on some unix platforms -printf is not an option
# for find. So instead we use sed to get to the filename without the fullpath
localDefinitions=`find ${def_dir}/grib1/ -name 'local.98.*def' | sed -e 's:.*/::' |\
localDefinitions=`find ${def_dir}/grib1/ -name 'local.98.*.def' | sed -e 's:.*/::' |\
awk 'BEGIN {FS=".";} {print $3;}' |\
grep -v def |\
sed '/245/d' |\
sed '/12/d' |\
sed '/50/d' |\
sed '/244/d' |\
sed '/190/d' |\
sed '/191/d' |\
sed '/192/d' |\
xargs`
count=0
for l1 in $localDefinitions
do
${tools_dir}/grib_set -M -s localDefinitionNumber=$l1 $temp locx.grib1
${tools_dir}/grib_filter -M $$_f locx.grib1
${tools_dir}/grib_set -M -s localDefinitionNumber=$l1 $tempGrib locx.grib1
${tools_dir}/grib_filter -M $tempFilt locx.grib1
for l2 in $localDefinitions
do
if [ $l1 -ne $l2 ]; then
#echo "$l1 -> $l2"
${tools_dir}/grib_set -M -s localDefinitionNumber=$l2 locx.grib1 locy.grib1
${tools_dir}/grib_filter -M $$_f locy.grib1
${tools_dir}/grib_filter -M $tempFilt locy.grib1
count=$((count+1))
fi
done
done
rm -f $$_f locx.grib1 locy.grib1 $temp
echo Did $count iterations
rm -f locx.grib1 locy.grib1 $tempGrib $tempFilt

View File

@ -20,7 +20,7 @@ int main(int argc, char** argv)
FILE* in = NULL;
const char* infile = "../data/test_uuid.grib2";
FILE* out = NULL;
const char* outfile = "temp.grib_set_bytes.grib";
const char* outfile = "temp.grib_set_bytes_test.grib";
grib_handle* h = NULL;
const void* buffer = NULL;

View File

@ -9,14 +9,17 @@
#
. ./include.ctest.sh
TEMP_ERR=temp.grib_set_bytes.log
TEMP_OUT=temp.grib_set_bytes.grib
$EXEC ${test_dir}/grib_set_bytes 2>$TEMP_ERR
label="grib_set_bytes_test"
grep -q "Wrong size.*for uuidOfVGrid. It is 16 bytes long" $TEMP_ERR
tempErr=temp.$label.log
tempOut=temp.$label.grib
uuid=`${tools_dir}/grib_get -p uuidOfVGrid $TEMP_OUT`
$EXEC ${test_dir}/grib_set_bytes 2>$tempErr
grep -q "Wrong size.*for uuidOfVGrid. It is 16 bytes long" $tempErr
uuid=`${tools_dir}/grib_get -p uuidOfVGrid $tempOut`
[ "$uuid" = "07204051072040510720405207204053" ]
rm -f $TEMP_OUT $TEMP_ERR
rm -f $tempOut $tempErr

View File

@ -10,7 +10,10 @@
. ./include.ctest.sh
TEMP=output.grib_sh_imag.grib
$EXEC ${test_dir}/grib_sh_imag $TEMP
# Check that first coefficient have an imaginary part equal to zero.
# philippe.marguinaud@meteo.fr, 2016/02
rm -f $TEMP
tempGrib=output.grib_sh_imag.grib
$EXEC ${test_dir}/grib_sh_imag $tempGrib
rm -f $tempGrib

View File

@ -10,24 +10,24 @@
. ./include.ctest.sh
label="grib_statistics_test"
temp1=temp1.$label.grib
temp2=temp2.$label.grib
files="regular_latlon_surface.grib2 regular_latlon_surface.grib1"
for file in $files
do
for file in $files; do
cat >statistics.filter<<EOF
set Ni=2;
set Nj=2;
set decimalPrecision=4;
set values={2.0,2.0,2.0,2.0};
print "values=[values]";
print "max=[max] min=[min] average=[average]";
set values={2.0,5.0,2.0,2.0};
print "values=[values]";
print "max=[max] min=[min] average=[average]";
set Ni=2;
set Nj=2;
set decimalPrecision=4;
set values={2.0,2.0,2.0,2.0};
print "values=[values]";
print "max=[max] min=[min] average=[average]";
set values={2.0,5.0,2.0,2.0};
print "values=[values]";
print "max=[max] min=[min] average=[average]";
EOF
${tools_dir}/grib_filter statistics.filter ${data_dir}/$file > statistics.out
@ -42,8 +42,6 @@ rm -f statistics.out statistics.filter
# See ECC-478
# ---------------------------------------------------
input=${data_dir}/lfpw.grib1
temp1=temp1.statistics.grib
temp2=temp2.statistics.grib
stats=`${tools_dir}/grib_get -w count=50 -F%.2f -n statistics $input`
[ "$stats" = "10098.00 0.00 1064.19 3066.07 2.57 4.61 0.00" ]