From 6a55afe429d3664feac31a43a8d993e76a06520a Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 16 May 2022 14:26:29 +0100 Subject: [PATCH] Testing: add test for grib_set -S option --- tests/grib_set.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/grib_set.sh b/tests/grib_set.sh index b2766ace7..6aa665a60 100755 --- a/tests/grib_set.sh +++ b/tests/grib_set.sh @@ -137,5 +137,20 @@ set -e grep -q "String cannot be converted to a double" $temp +# Strict option +# --------------- +# There is only one field in this file with shortName=2t +input=${data_dir}/tigge_cf_ecmwf.grib2 +# This copies all messages to the output changing one of them +${tools_dir}/grib_set -w shortName=2t -s offsetValuesBy=0.5 $input $outfile +count=`${tools_dir}/grib_count $outfile` +[ $count -eq 43 ] +# Now we copy only what was changed +${tools_dir}/grib_set -w shortName=2t -S -s offsetValuesBy=0.5 $input $outfile +count=`${tools_dir}/grib_count $outfile` +[ $count -eq 1 ] +grib_check_key_equals $outfile shortName '2t' + + # Clean up rm -f $outfile $temp