From 27b85923aa86621475190674c5cdf627bdb4a3e2 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 10 Mar 2021 12:03:20 +0000 Subject: [PATCH] ECC-1212: Add test and fix the grib_ls date issue --- definitions/grib2/template.4.localtime.def | 3 + tests/CMakeLists.txt | 1 + tests/grib_ecc-1212.sh | 81 ++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100755 tests/grib_ecc-1212.sh diff --git a/definitions/grib2/template.4.localtime.def b/definitions/grib2/template.4.localtime.def index 8a9f5137a..6324bedcc 100644 --- a/definitions/grib2/template.4.localtime.def +++ b/definitions/grib2/template.4.localtime.def @@ -73,3 +73,6 @@ if (numberOfForecastsUsedInLocalTime == 1) { alias mars.step = endStep; } + +# See ECC-707 +alias ls.date = dataDate; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9d7bfc8f5..1e99e9e9c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -80,6 +80,7 @@ if( HAVE_BUILD_TOOLS ) grib_ecc-1167 grib_ecc-1170 grib_ecc-1195 + grib_ecc-1212 bufr_ecc-1195 bufr_json_samples bufr_ecc-359 diff --git a/tests/grib_ecc-1212.sh b/tests/grib_ecc-1212.sh new file mode 100755 index 000000000..7f69c927f --- /dev/null +++ b/tests/grib_ecc-1212.sh @@ -0,0 +1,81 @@ +#!/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.sh +set -u +REDIRECT=/dev/null +label="grib_ecc-1212-test" +tempGrib=temp.$label.grib +tempFilt=temp.$label.filt +tempOut=temp.$label.out +tempRef=temp.$label.ref +sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl + +# Create a GRIB with the local time template +cat > $tempFilt < $tempOut +cat > $tempRef < $tempOut +echo "2 ecmf 20200805 an regular_ll surface 0 t grid_simple" > $tempRef +cat $tempOut +diff $tempRef $tempOut + + +# Clean up +rm -f $tempGrib $tempFilt $tempOut $tempRef