diff --git a/definitions/grib2/products_8.def b/definitions/grib2/products_8.def index a1c28ffc7..a700457b5 100644 --- a/definitions/grib2/products_8.def +++ b/definitions/grib2/products_8.def @@ -1,5 +1,9 @@ # (C) Copyright 2005- ECMWF. # Uncertainties in ensembles of regional re-analysis project (UERRA) +if(localUsePresent == 0){ constant marsExpver = 'prod'; +} else { +constant marsExpver = experimentVersionNumber; +} include "grib2/products_uerra.def" diff --git a/definitions/grib2/products_9.def b/definitions/grib2/products_9.def index 3b2d3a4de..21b99733e 100644 --- a/definitions/grib2/products_9.def +++ b/definitions/grib2/products_9.def @@ -1,5 +1,9 @@ # (C) Copyright 2005- ECMWF. # Uncertainties in ensembles of regional re-analysis project test (UERRA) +if(localUsePresent == 0){ constant marsExpver = 'test'; +} else { +constant marsExpver = experimentVersionNumber; +} include "grib2/products_uerra.def" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 66210fd50..45af8a77d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -82,6 +82,7 @@ if( HAVE_BUILD_TOOLS ) grib_packing_order filter_substr grib_uerra + grib_ecc-1571 grib_s2s grib_fire # grib_true_imagery diff --git a/tests/grib_ecc-1571.sh b/tests/grib_ecc-1571.sh new file mode 100755 index 000000000..262dc82ce --- /dev/null +++ b/tests/grib_ecc-1571.sh @@ -0,0 +1,38 @@ +#!/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="prod_ECC-1571" # Change prod to bufr or grib etc +tempGrib1=temp1.$label.grib2 +tempGrib2=temp2.$label.grib2 +sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl + +# 1st we create a sample file for UERRA with centre lfpw +${tools_dir}/grib_set -s centre=lfpw,productionStatusOfProcessedData=8 ${sample_grib2} ${tempGrib1} +# Now we use the UERRA sample and add a local section to it +${tools_dir}/grib_set -s setLocalDefinition=1,grib2LocalSectionNumber=0,uerraLocalVersion=1 ${tempGrib1} ${tempGrib2} + +# We should have a local section with uerraLocalVersion=1,experimentVersionNumber=0002 +grib_check_key_equals ${tempGrib2} uerraLocalVersion,experimentVersionNumber "1 0002" +grib_check_key_equals ${tempGrib2} 'marsExpver,mars.expver' '0002 0002' + +# set other expver +${tools_dir}/grib_set -s setLocalDefinition=1,grib2LocalSectionNumber=0,uerraLocalVersion=1,experimentVersionNumber=1234 ${tempGrib1} ${tempGrib2} +grib_check_key_equals ${tempGrib2} uerraLocalVersion,experimentVersionNumber "1 1234" + +rm -f ${tempGrib1} ${tempGrib2} + + + + +