1#!/bin/sh
2# (C) Copyright 2005- ECMWF.
3#
4# This software is licensed under the terms of the Apache Licence Version 2.0
5# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6#
7# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
8# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
9#
10
11set -x
12. ./include.sh
13
14REDIRECT=/dev/null
15
16cat > bufrdc_num_ref.filter<<EOF
17print "[numericValues!1%23.14e]";
18EOF
19
20bufr_files=`cat ${data_dir}/bufr/bufr_data_files.txt`
21
22for bf in ${bufr_files}
23do
24  file=${data_dir}/bufr/$bf
25  # Test numeric data: compare output of filter (res) with reference file (ref)
26  res_num=$file.num.test
27  ref_num=$file.num.ref
28  diff_num=$file.num.diff
29
30  rm -f $res_num
31
32  ${tools_dir}/codes_bufr_filter bufrdc_num_ref.filter $file 2> $REDIRECT > $res_num
33
34  # Exclude the BUFR file uegabe.bufr because its reference file is incorrect
35  if [ "$bf" = "uegabe.bufr" ]; then
36    rm -f $res_num
37    continue
38  fi
39
40  if [ -f "$ref_num" ]; then
41    # Cannot use plain diff. We need to compare FLOAT NUMBERS with a tolerance
42    perl number_compare.pl $ref_num $res_num # >$REDIRECT 2> $REDIRECT
43    #numdiff               $ref_num $res_num >$REDIRECT 2> $REDIRECT
44  fi
45
46  rm -f $res_num
47done
48
49rm -f bufrdc_num_ref.filter
50