ECC-967: GRIB2: Fallback if tables version is bigger than the latest installed version

This commit is contained in:
Shahram Najm 2019-08-15 14:01:38 +01:00
commit 480e3ef8ff
3 changed files with 33 additions and 0 deletions

View File

@ -26,6 +26,9 @@ codetable[1] tablesVersion 'grib2/tables/1.0.table' = tablesVersionLatest : edit
alias gribMasterTablesVersionNumber=tablesVersion;
transient masterDir="grib2/tables/[tablesVersion]";
if (tablesVersion > tablesVersionLatest) {
transient masterDir="grib2/tables/[tablesVersionLatest]";
}
when (tablesVersion!=255) {
set masterDir="grib2/tables/[tablesVersion]";
} else {

View File

@ -55,6 +55,7 @@ list( APPEND tests_no_data_reqd
grib_uerra
grib_2nd_order_numValues
grib_ecc-136
grib_ecc-967
julian
bufr_dump_samples
bufr_json_samples

29
tests/grib_ecc-967.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
# Copyright 2005-2019 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.sh
set -u
# ---------------------------------------------------------
# This is the test for the JIRA issue ECC-967.
# GRIB2: Fallback if tables version > latest installed version
# ---------------------------------------------------------
label="grib_ecc-967-test"
temp=temp.${label}.grib
# Pick a master tables version number way to big!
# But one day we will actually get to it.
input=$ECCODES_SAMPLES_PATH/reduced_gg_pl_160_grib2.tmpl
${tools_dir}/grib_set -s tablesVersion=253 $input $temp
grib_check_key_equals $temp 'typeOfFirstFixedSurface:i' '100'
grib_check_key_equals $temp 'typeOfFirstFixedSurface:s' 'pl'
grib_check_key_equals $temp 'mars.levtype' 'pl'
# Clean up
rm -f $temp