From a4f5a6171d3ccb04a9a09e409906c0541e4ef471 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 9 May 2018 15:35:08 +0100 Subject: [PATCH] Add test for ECC-671 (setting GRIB string keys in Fortran) --- examples/F90/CMakeLists.txt | 1 + examples/F90/grib_ecc-671.f90 | 33 +++++++++++++++++++++++++++++++++ examples/F90/grib_ecc-671.sh | 13 +++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 examples/F90/grib_ecc-671.f90 create mode 100755 examples/F90/grib_ecc-671.sh diff --git a/examples/F90/CMakeLists.txt b/examples/F90/CMakeLists.txt index 15c43fdb3..bbaa156de 100644 --- a/examples/F90/CMakeLists.txt +++ b/examples/F90/CMakeLists.txt @@ -30,6 +30,7 @@ list( APPEND tests grib_count_messages grib_count_messages_multi grib_copy_namespace + grib_ecc-671 read_message read_from_file get_set_uuid diff --git a/examples/F90/grib_ecc-671.f90 b/examples/F90/grib_ecc-671.f90 new file mode 100644 index 000000000..8a02233c8 --- /dev/null +++ b/examples/F90/grib_ecc-671.f90 @@ -0,0 +1,33 @@ +! Copyright 2005-2018 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. +! +! Description: set string key with spaces +! +! +USE eccodes + + INTEGER :: IGRIBH + CHARACTER (LEN=17) :: CLNOMA1, CLNOMA2 + + CALL codes_grib_new_from_samples(IGRIBH, "regular_ll_sfc_grib2") + + ! set centre to MeteoFrance and use their local definition + CALL codes_set (IGRIBH, 'centre', 85) + CALL codes_set (IGRIBH, 'grib2LocalSectionPresent', 1) + CALL codes_set (IGRIBH, 'grib2LocalSectionNumber', 1) + + CLNOMA1 = 'SUNSHI. DURATION' + CALL codes_set_string(IGRIBH, 'CLNOMA', CLNOMA1) + CALL codes_get_string(IGRIBH, 'CLNOMA', CLNOMA2) + + PRINT *, " CLNOMA1 = ", CLNOMA1 + PRINT *, " CLNOMA2 = ", CLNOMA2 + + IF (CLNOMA1 /= CLNOMA2) STOP 1 + +END diff --git a/examples/F90/grib_ecc-671.sh b/examples/F90/grib_ecc-671.sh new file mode 100755 index 000000000..a0f80e41e --- /dev/null +++ b/examples/F90/grib_ecc-671.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Copyright 2005-2018 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 + +exec ${examples_dir}/eccodes_f_grib_ecc-671