2013-03-25 12:04:10 +00:00
|
|
|
#!/bin/sh
|
2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2013-03-25 12:04:10 +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.
|
2013-03-25 14:23:07 +00:00
|
|
|
#
|
2013-03-25 12:04:10 +00:00
|
|
|
# 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
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2021-07-01 18:24:48 +00:00
|
|
|
label="pseudo_budg_test"
|
2022-06-06 14:41:18 +00:00
|
|
|
|
2021-07-01 18:24:48 +00:00
|
|
|
tempOut=temp.$label.txt
|
|
|
|
tempRef=temp.$label.ref
|
2021-08-20 15:36:37 +00:00
|
|
|
tempBud=temp.$label.bud
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2024-04-30 07:36:28 +00:00
|
|
|
# Abort if any error messages are posted
|
|
|
|
export ECCODES_FAIL_IF_LOG_MESSAGE=1
|
|
|
|
|
2021-07-01 18:24:48 +00:00
|
|
|
${tools_dir}/grib_ls -j ${data_dir}/budg > $tempOut
|
|
|
|
cat > $tempRef << EOF
|
|
|
|
{ "messages" : [
|
|
|
|
{
|
|
|
|
"identifier": "BUDG",
|
|
|
|
"centre": "ecmf",
|
|
|
|
"levelType": "sfc",
|
|
|
|
"date": 20061204,
|
|
|
|
"stepRange": 0,
|
|
|
|
"parameter": 128
|
|
|
|
}
|
|
|
|
]}
|
|
|
|
EOF
|
|
|
|
diff $tempRef $tempOut
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2021-08-20 15:36:37 +00:00
|
|
|
# Set date
|
|
|
|
${tools_dir}/grib_set -s date=20170102 ${data_dir}/budg $tempBud
|
|
|
|
res=`${tools_dir}/grib_get -p mars.date $tempBud`
|
|
|
|
[ "$res" = "20170102" ]
|
|
|
|
|
2021-07-01 18:24:48 +00:00
|
|
|
${tools_dir}/grib_dump ${data_dir}/budg
|
|
|
|
${tools_dir}/grib_dump -O ${data_dir}/budg
|
|
|
|
|
2021-08-15 15:18:59 +00:00
|
|
|
ms=`${tools_dir}/grib_get -p mars.step ${data_dir}/budg`
|
|
|
|
[ "$ms" = "0" ]
|
|
|
|
${tools_dir}/grib_set -s mars.step=19 ${data_dir}/budg $tempOut
|
|
|
|
${tools_dir}/grib_ls -jm $tempOut
|
|
|
|
ms=`${tools_dir}/grib_get -p mars.step $tempOut`
|
|
|
|
[ "$ms" = "19" ]
|
|
|
|
|
2022-12-06 13:51:51 +00:00
|
|
|
# ECC-1491
|
|
|
|
cat ${data_dir}/budg ${data_dir}/budg > $tempBud
|
|
|
|
${tools_dir}/grib_get -p count,offset $tempBud > $tempOut
|
|
|
|
cat > $tempRef << EOF
|
|
|
|
1 0
|
|
|
|
2 6000
|
|
|
|
EOF
|
|
|
|
diff $tempRef $tempOut
|
|
|
|
|
2023-06-21 17:55:04 +00:00
|
|
|
# Count
|
|
|
|
count=`${tools_dir}/grib_count ${data_dir}/budg`
|
|
|
|
[ $count -eq 1 ]
|
2021-08-15 15:18:59 +00:00
|
|
|
|
2021-08-20 15:36:37 +00:00
|
|
|
rm -f $tempRef $tempOut $tempBud
|