ECC-1840: BUFR: Problem with edition 3 typicalDate and typicalTime

This commit is contained in:
shahramn 2024-06-06 15:22:06 +01:00
parent 76179dc518
commit 9cd97a7d73
3 changed files with 38 additions and 1 deletions

View File

@ -20,7 +20,8 @@ unsigned[1] localTablesVersionNumber : dump;
transient typicalCentury=21;
unsigned[1] typicalYearOfCentury : dump;
transient typicalYear = (typicalCentury - 1) * 100 + typicalYearOfCentury : no_copy;
# ECC-1840: Use the 'evaluate' accessor so typicalYear is updated if user changes typicalCentury
meta typicalYear evaluate( (typicalCentury - 1) * 100 + typicalYearOfCentury ) : no_copy;
unsigned[1] typicalMonth : dump;
unsigned[1] typicalDay : dump;

View File

@ -156,6 +156,7 @@ if( HAVE_BUILD_TOOLS )
bufr_ecc-1304
bufr_ecc-1347
bufr_ecc-1395
bufr_ecc-1840
bufr_json_samples
bufr_ecc-359
bufr_ecc-517

35
tests/bufr_ecc-1840.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# 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
REDIRECT=/dev/null
label="bufr_ecc-1840_test"
tempBufr=temp.$label.bufr
tempFilt=temp.$label.filt
tempLog=temp.$label.log
tempOut=temp.$label.txt
tempRef=temp.$label.ref
sample_bufr3=$ECCODES_SAMPLES_PATH/BUFR3.tmpl
# This sample has:
# typicalYearOfCentury = 12
# typicalMonth = 10
# typicalDay = 31
result=$(${tools_dir}/bufr_get -p typicalYear,typicalDate $sample_bufr3)
[ "$result" = "2012 20121031" ]
result=$(${tools_dir}/bufr_get -p typicalYear,typicalDate -s typicalCentury=20 $sample_bufr3)
[ "$result" = "1912 19121031" ]
# Clean up
rm -f $tempBufr $tempFilt $tempLog $tempOut $tempRef