eccodes/examples/F90/bufr_subset.sh

92 lines
3.3 KiB
Bash
Raw Normal View History

2015-02-09 12:30:11 +00:00
#!/bin/sh
2020-01-28 14:32:34 +00:00
# (C) Copyright 2005- ECMWF.
2015-02-09 12:30:11 +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.
#
. ./include.ctest.sh
2015-02-09 12:30:11 +00:00
#Define a common label for all the tmp files
label="bufr_subset_test_f"
#Prepare tmp file
fTmp=${label}.tmp.txt
fTmp2=${label}.tmp2.txt
rm -f $fTmp
2015-02-09 12:30:11 +00:00
2015-10-28 11:46:53 +00:00
#Prepare ref file
fRef=${label}.ref
cat > $fRef <<EOF
message: 0
numberOfSubsets: 12
/subsetNumber=00001/blockNumber
subsetNumber: 1
blockNumber: 1
stationNumber: 485
/subsetNumber=00002/blockNumber
subsetNumber: 2
blockNumber: 1
stationNumber: 485
/subsetNumber=00003/blockNumber
subsetNumber: 3
blockNumber: 1
stationNumber: 485
/subsetNumber=00004/blockNumber
subsetNumber: 4
blockNumber: 1
stationNumber: 485
/subsetNumber=00005/blockNumber
subsetNumber: 5
blockNumber: 1
stationNumber: 485
/subsetNumber=00006/blockNumber
subsetNumber: 6
blockNumber: 1
stationNumber: 485
/subsetNumber=00007/blockNumber
subsetNumber: 7
blockNumber: 1
stationNumber: 485
/subsetNumber=00008/blockNumber
subsetNumber: 8
blockNumber: 1
stationNumber: 485
/subsetNumber=00009/blockNumber
subsetNumber: 9
blockNumber: 1
stationNumber: 485
/subsetNumber=00010/blockNumber
subsetNumber: 10
blockNumber: 1
stationNumber: 485
/subsetNumber=00011/blockNumber
subsetNumber: 11
blockNumber: 1
stationNumber: 485
/subsetNumber=00012/blockNumber
subsetNumber: 12
blockNumber: 1
stationNumber: 485
EOF
2015-02-09 12:30:11 +00:00
#We check "synop_multi_subset.bufr". The path is
#hardcoded in the example
2015-10-28 11:46:53 +00:00
REDIRECT=/dev/stdout
2015-02-09 12:30:11 +00:00
#Write the values into a file and compare with reference
2015-07-14 16:11:57 +00:00
${examples_dir}/eccodes_f_bufr_subset 2> $REDIRECT > $fTmp
2015-02-09 12:30:11 +00:00
# Remove blank lines
sed '/^\s*$/d' < $fTmp > $fTmp2
2015-02-09 12:30:11 +00:00
#We compare output to the reference by ignoring the whitespaces
diff -w $fRef $fTmp2 >$REDIRECT 2> $REDIRECT
2015-02-09 12:30:11 +00:00
#Clean up
rm -f $fTmp $fTmp2 $fRef