2016-04-04 13:27:04 +00:00
|
|
|
#!/bin/sh
|
2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2016-04-04 13:27:04 +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-04-04 13:27:04 +00:00
|
|
|
|
|
|
|
#Enter data dir
|
|
|
|
cd ${data_dir}/gts
|
|
|
|
|
|
|
|
label="gts_get_test"
|
|
|
|
|
|
|
|
fLog=${label}".log"
|
|
|
|
rm -f $fLog
|
|
|
|
|
|
|
|
fTmp=${label}".tmp.txt"
|
|
|
|
|
|
|
|
#----------------------------------------------
|
|
|
|
# Test "-p" switch
|
|
|
|
#----------------------------------------------
|
|
|
|
gts_file=EGRR20150317121020_00493212.DAT
|
|
|
|
${tools_dir}/gts_get -p TT,AA,II,CCCC,YY,GG,gg,BBB $gts_file >/dev/null
|
|
|
|
|
2023-12-31 17:23:54 +00:00
|
|
|
#----------------------------------------------
|
|
|
|
# Test "-w" switch
|
|
|
|
#----------------------------------------------
|
2024-01-10 12:42:17 +00:00
|
|
|
${tools_dir}/gts_get -p TT -w count=3 $gts_file
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------
|
|
|
|
# Test "-s" switch
|
|
|
|
#----------------------------------------------
|
|
|
|
result=$( ${tools_dir}/gts_get -s YY=ab -p YY -w count=3 $gts_file )
|
|
|
|
[ "$result" = "ab" ]
|
2023-12-31 17:23:54 +00:00
|
|
|
|
|
|
|
|
2023-11-07 13:49:02 +00:00
|
|
|
gts_file=${data_dir}/gts.grib
|
|
|
|
result=$( ${tools_dir}/grib_get -wcount=1 -p gts_CCCC -g $gts_file )
|
|
|
|
[ "$result" = "ECMG" ]
|
|
|
|
|
|
|
|
${tools_dir}/grib_get -wcount=1 -p gts_header -g $gts_file
|
|
|
|
|
2023-11-07 14:17:00 +00:00
|
|
|
# Encoding should be disabled
|
|
|
|
# -----------------------------
|
|
|
|
set +e
|
|
|
|
${tools_dir}/grib_set -s gts_CCCC=xxx -g $gts_file $fTmp
|
|
|
|
status=$?
|
|
|
|
set -e
|
|
|
|
[ $status -ne 0 ]
|
2023-11-07 13:49:02 +00:00
|
|
|
|
2023-11-07 14:17:00 +00:00
|
|
|
set +e
|
|
|
|
${tools_dir}/grib_set -s gts_header=yyy -g $gts_file $fTmp
|
|
|
|
status=$?
|
|
|
|
set -e
|
|
|
|
[ $status -ne 0 ]
|
|
|
|
|
|
|
|
|
|
|
|
# Clean up
|
|
|
|
rm -f $fLog $fTmp
|