From c791ee1c82cac024100f9c9c4b7779ba4bd6721b Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 4 Nov 2016 17:11:30 +0000 Subject: [PATCH] Testing: add test for C ensemble index example --- examples/C/CMakeLists.txt | 1 + examples/C/grib_ensemble_index.c | 4 +++- examples/C/grib_ensemble_index.sh | 13 +++++++++++++ examples/python/grib_index.sh | 5 ++--- 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100755 examples/C/grib_ensemble_index.sh diff --git a/examples/C/CMakeLists.txt b/examples/C/CMakeLists.txt index 691937607..7dd423816 100644 --- a/examples/C/CMakeLists.txt +++ b/examples/C/CMakeLists.txt @@ -70,6 +70,7 @@ list( APPEND tests grib_precision grib_clone grib_copy_message + grib_ensemble_index grib_set_pv grib_set_bitmap grib_list diff --git a/examples/C/grib_ensemble_index.c b/examples/C/grib_ensemble_index.c index b17ad63cf..10d7b0cd3 100644 --- a/examples/C/grib_ensemble_index.c +++ b/examples/C/grib_ensemble_index.c @@ -30,9 +30,11 @@ int main(int argc, char * argv[]) double min=1e13,max=-1e13,avg=0; codes_index* index; codes_handle* h=NULL; + + if (argc<2) return 1; /* create index of file contents for paramId and number */ - index = codes_index_new_from_file(0, "eps", "paramId,number",&ret); + index = codes_index_new_from_file(0, argv[1], "paramId,number",&ret); CODES_CHECK(ret,0); /* get size of "paramId" list */ diff --git a/examples/C/grib_ensemble_index.sh b/examples/C/grib_ensemble_index.sh new file mode 100755 index 000000000..b21379669 --- /dev/null +++ b/examples/C/grib_ensemble_index.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Copyright 2005-2016 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 + +input="../../data/index.grib" +${examples_dir}c_grib_ensemble_index $input diff --git a/examples/python/grib_index.sh b/examples/python/grib_index.sh index 9e1a44e6e..110dde63f 100755 --- a/examples/python/grib_index.sh +++ b/examples/python/grib_index.sh @@ -2,6 +2,5 @@ . ./include.sh -REDIRECT=/dev/null -$PYTHON $examples_src/grib_index.py 2> $REDIRECT > $REDIRECT -rm my.idx || true +$PYTHON $examples_src/grib_index.py +rm -f my.idx