2016-11-29 15:00:08 +00:00
|
|
|
#!/bin/sh
|
2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2016-11-29 15:00:08 +00:00
|
|
|
#
|
|
|
|
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
|
|
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
#
|
|
|
|
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
|
|
|
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
|
|
|
#
|
|
|
|
|
2022-04-03 22:02:48 +00:00
|
|
|
. ./include.ctest.sh
|
2016-11-29 15:00:08 +00:00
|
|
|
|
|
|
|
# ---------------------------------------------------------
|
|
|
|
# This is the test for the JIRA issue ECC-393
|
|
|
|
# It tests bufr_compare with a blacklist with rank
|
|
|
|
# ---------------------------------------------------------
|
|
|
|
cd ${data_dir}/bufr
|
2022-06-01 15:02:34 +00:00
|
|
|
label="bufr_ecc-393_test"
|
2016-11-29 15:00:08 +00:00
|
|
|
|
|
|
|
tempRules=temp.${label}.filter
|
|
|
|
tempOut=temp.${label}.bufr
|
|
|
|
tempText=temp.${label}.txt
|
|
|
|
tempRef=temp.${label}.ref
|
|
|
|
BufrFile=aaen_55.bufr
|
|
|
|
|
|
|
|
cat > $tempRules <<EOF
|
|
|
|
set unpack=1;
|
|
|
|
set #3#channelQualityFlagsForAtovs=1;
|
|
|
|
set #5#channelQualityFlagsForAtovs=2;
|
|
|
|
set pack=1;
|
|
|
|
write;
|
|
|
|
EOF
|
|
|
|
|
2017-08-29 16:49:30 +00:00
|
|
|
${tools_dir}/codes_bufr_filter -o $tempOut $tempRules $BufrFile
|
2016-11-29 15:00:08 +00:00
|
|
|
|
|
|
|
# There are two differences. So this should fail
|
|
|
|
set +e
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/bufr_compare $tempOut $BufrFile
|
2016-11-29 15:00:08 +00:00
|
|
|
status=$?
|
|
|
|
set -e
|
|
|
|
[ $status -eq 1 ]
|
|
|
|
|
|
|
|
# Blacklist all the channelQualityFlagsForAtovs keys
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/bufr_compare -b channelQualityFlagsForAtovs $tempOut $BufrFile
|
2016-11-29 15:00:08 +00:00
|
|
|
|
|
|
|
# Blacklist both the channelQualityFlagsForAtovs keys individually
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/bufr_compare -b '#3#channelQualityFlagsForAtovs,#5#channelQualityFlagsForAtovs' $tempOut $BufrFile
|
2016-11-29 15:00:08 +00:00
|
|
|
|
|
|
|
# Blacklist only one of the channelQualityFlagsForAtovs keys. Will fail
|
|
|
|
set +e
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/bufr_compare -b '#5#channelQualityFlagsForAtovs' $tempOut $BufrFile >$tempText
|
2016-11-29 15:00:08 +00:00
|
|
|
status=$?
|
|
|
|
set -e
|
|
|
|
[ $status -eq 1 ]
|
|
|
|
|
|
|
|
cat > $tempRef <<EOF
|
|
|
|
== 1 == DIFFERENCE == long [#3#channelQualityFlagsForAtovs]: [1] != [0]
|
|
|
|
EOF
|
|
|
|
diff $tempRef $tempText
|
|
|
|
|
|
|
|
# Clean
|
|
|
|
rm -rf $tempOut $tempRules $tempRef $tempText
|