Tests: check bufr_compare input path

This commit is contained in:
Shahram Najm 2019-12-27 11:53:03 +00:00
parent bbe5e29b71
commit feede5aaca
3 changed files with 28 additions and 8 deletions

View File

@ -56,7 +56,7 @@ set -e
# Test: comparing with and without the -b switch
#----------------------------------------------------
f="syno_1.bufr"
echo "Test: comparing with and witout the -b switch" >> $fLog
echo "Test: comparing with and without the -b switch" >> $fLog
echo "file: $f" >> $fLog
#Alter a key in the file
@ -92,6 +92,7 @@ ${tools_dir}/bufr_compare -b dataCategory $f ${fBufrTmp}>> $fLog
#----------------------------------------------------
# Change subCentre and compare
#----------------------------------------------------
echo "Test: Change subCentre and compare" >> $fLog
${tools_dir}/bufr_set -s bufrHeaderSubCentre=12 aaen_55.bufr $fBufrTmp
set +e
${tools_dir}/bufr_compare aaen_55.bufr $fBufrTmp > $fLog 2>&1
@ -100,9 +101,23 @@ set -e
[ $status -eq 1 ]
fgrep -q "[bufrHeaderSubCentre]: [70] != [12]" $fLog
#----------------------------------------------------
# First argument of bufr_compare is a directory (error)
#----------------------------------------------------
echo "Test: First argument of bufr_compare is a directory (error)" >> $fLog
temp_dir=tempdir.${label}
mkdir -p $temp_dir
set +e
${tools_dir}/bufr_compare $temp_dir aaen_55.bufr >/dev/null
status=$?
set -e
[ $status -eq 1 ]
rm -fr $temp_dir
#----------------------------------------------------
# Second argument of bufr_compare is a directory
#----------------------------------------------------
echo "Test: Second argument of bufr_compare is a directory" >> $fLog
temp_dir=tempdir.${label}
mkdir -p $temp_dir
infile=aaen_55.bufr
@ -113,6 +128,7 @@ rm -fr $temp_dir
#----------------------------------------------------
# Compare attributes
#----------------------------------------------------
echo "Test: Compare attributes" >> $fLog
set +e
${tools_dir}/bufr_compare amv2_87.bufr amv3_87.bufr > $fLog 2>&1
status=$?
@ -124,8 +140,9 @@ grep -q "#1#windSpeed->percentConfidence" $fLog
grep -q "#1#coldestClusterTemperature->percentConfidence" $fLog
#----------------------------------------------------
# Header only mode
# Header-only mode
#----------------------------------------------------
echo "Test: Header-only mode" >> $fLog
f="syno_1.bufr"
cat > $fRules <<EOF
set unpack=1;
@ -141,6 +158,7 @@ ${tools_dir}/bufr_compare -H $f $fBufrTmp
#----------------------------------------------------
# Compare two-way (symmetric mode)
#----------------------------------------------------
echo "Test: Compare two-way (symmetric mode)" >> $fLog
f=$ECCODES_SAMPLES_PATH/BUFR3.tmpl
# Add a local section
${tools_dir}/bufr_set -s section2Present=1 $f $fBufrTmp
@ -156,16 +174,17 @@ set -e
#----------------------------------------------------
# ECC-656: using relative comparison (-R) with 'all'
#----------------------------------------------------
echo "Test: ECC-656: using relative comparison (-R) with 'all'" >> $fLog
f='airc_142.bufr'
echo 'set unpack=1;set airTemperature=228; set height=1.037e+04; set pack=1; write;' |\
${tools_dir}/codes_bufr_filter -o $fBufrTmp - $f
${tools_dir}/bufr_compare -R airTemperature=0.004,height=0.001 $f $fBufrTmp
${tools_dir}/bufr_compare -R all=0.004 $f $fBufrTmp
#----------------------------------------------------
# ECC-658: apply relative comparison (-R) to all
# ranks of a given key
#----------------------------------------------------
#--------------------------------------------------------------------
# ECC-658: apply relative comparison (-R) to all ranks of a given key
#--------------------------------------------------------------------
echo "Test: ECC-658: apply relative comparison (-R) to all ranks of a given key" >> $fLog
f='PraticaTemp.bufr'
${tools_dir}/codes_bufr_filter -o $fBufrTmp - $f <<EOF
set unpack=1;
@ -180,6 +199,7 @@ EOF
# The relative differences are around 3.5e-5. Suppress all instances
${tools_dir}/bufr_compare -R airTemperature=4e-5 $f $fBufrTmp
# Clean up
# -------------
rm -f $fLog $fBufrTmp $fBufrInput1 $fBufrInput2 $fRules

View File

@ -55,7 +55,7 @@ if [ $status -eq 0 ]; then
fi
#----------------------------------------------------
# Test: comparing with and witout the -b switch
# Test: comparing with and without the -b switch
#----------------------------------------------------
${tools_dir}//gts_compare -b GG $gts_file $fGtsTmp >> $fLog

View File

@ -48,7 +48,7 @@ if [ $status -eq 0 ]; then
fi
#----------------------------------------------------
# Test: comparing with and witout the -b switch
# Test: comparing with and without the -b switch
#----------------------------------------------------
# ${tools_dir}/metar_compare -b GG $metar_file $fMetarTmp >> $fLog