2015-02-02 17:17:29 +00:00
|
|
|
#!/bin/sh
|
2018-01-02 11:31:02 +00:00
|
|
|
# Copyright 2005-2018 ECMWF.
|
2015-02-02 17:17:29 +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.sh
|
|
|
|
|
|
|
|
#Enter data dir
|
|
|
|
cd ${data_dir}/bufr
|
|
|
|
|
|
|
|
#Define a common label for all the tmp files
|
|
|
|
label="bufr_get_test"
|
|
|
|
|
|
|
|
#Create log file
|
|
|
|
fLog=${label}".log"
|
|
|
|
rm -f $fLog
|
|
|
|
touch $fLog
|
|
|
|
|
|
|
|
#Define tmp file
|
|
|
|
fTmp=${label}".tmp.txt"
|
|
|
|
rm -f $fTmp
|
|
|
|
|
|
|
|
#Define another tmp file to store the test results
|
|
|
|
res_get=${label}".get.test"
|
|
|
|
rm -f $res_get
|
|
|
|
|
2018-08-30 12:07:14 +00:00
|
|
|
# Check identidier. Edition 3 and 4
|
|
|
|
id=`${tools_dir}/bufr_get -p edition,identifier avhn_87.bufr`
|
|
|
|
[ "$id" = "3 BUFR" ]
|
|
|
|
id=`${tools_dir}/bufr_get -p edition,identifier aaen_55.bufr`
|
|
|
|
[ "$id" = "4 BUFR" ]
|
|
|
|
|
|
|
|
|
2015-02-02 17:17:29 +00:00
|
|
|
#-------------------------------------------
|
|
|
|
# Test "-p" switch
|
|
|
|
#-------------------------------------------
|
|
|
|
f="aaen_55.bufr"
|
|
|
|
|
|
|
|
#The reference is the same as for ls
|
|
|
|
ref_get=$f".ls.ref"
|
|
|
|
|
|
|
|
echo "Test: -p switch" >> $fLog
|
|
|
|
echo "file: $f" >> $fLog
|
2016-07-05 12:10:01 +00:00
|
|
|
${tools_dir}/bufr_get -p totalLength,bufrHeaderCentre,bufrHeaderSubCentre,masterTableNumber,masterTablesVersionNumber,localTablesVersionNumber,numberOfSubsets,localNumberOfObservations $f > $fTmp
|
2015-02-02 17:17:29 +00:00
|
|
|
|
|
|
|
#Write the values into a file and compare with ref
|
|
|
|
cat $fTmp | awk '{split($0,a," "); for (i=1; i<=8; i++) print a[i]}' > $res_get
|
2015-08-27 15:06:43 +00:00
|
|
|
diff $ref_get $res_get
|
2015-02-02 17:17:29 +00:00
|
|
|
|
2016-09-16 15:23:03 +00:00
|
|
|
#-------------------------------------------
|
|
|
|
# ECC-236
|
|
|
|
#-------------------------------------------
|
|
|
|
result=`${tools_dir}/bufr_get -s unpack=1 -p nonCoordinatePressure syno_1.bufr`
|
|
|
|
[ "$result" = "100910" ]
|
|
|
|
result=`${tools_dir}/bufr_get -s unpack=1 -p stationOrSiteName bssh_176.bufr`
|
|
|
|
[ "$result" = "Helgoland" ]
|
|
|
|
result=`${tools_dir}/bufr_get -s unpack=1 -p majorFrameCount aaen_55.bufr`
|
|
|
|
[ "$result" = "MISSING" ]
|
|
|
|
result=`${tools_dir}/bufr_get -s unpack=1 -p satelliteIdentifier wavb_134.bufr`
|
|
|
|
[ "$result" = "MISSING" ]
|
|
|
|
|
2018-05-10 14:53:22 +00:00
|
|
|
#-------------------------------------------
|
|
|
|
# ECC-315: BUFR keys in the MARS namespace
|
|
|
|
#-------------------------------------------
|
|
|
|
result=`${tools_dir}/bufr_get -m aaen_55.bufr`
|
|
|
|
[ "$result" = "2 55 2012 11 2 0 0 8 209" ]
|
|
|
|
result=`${tools_dir}/bufr_get -m syno_1.bufr`
|
|
|
|
[ "$result" = "1 1 2012 10 30 0 0 0 7.45 151.83" ]
|
2016-09-16 15:23:03 +00:00
|
|
|
|
2015-02-04 13:52:37 +00:00
|
|
|
#Clean up
|
2016-07-05 12:10:01 +00:00
|
|
|
rm -f $fLog $fTmp $res_get
|