From 13982e7dbdcc31c7f0676f6fdd21824effccc247 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sun, 3 Sep 2023 16:12:58 +0100 Subject: [PATCH] Testing: GRIB2 product def templates --- tests/grib2_templates.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/grib2_templates.sh b/tests/grib2_templates.sh index 93daa7e5d..4b08f2619 100755 --- a/tests/grib2_templates.sh +++ b/tests/grib2_templates.sh @@ -35,8 +35,7 @@ done # Template 4.86 # ------------- -# TODO: Add tablesVersion later... -$tools_dir/grib_set -s productDefinitionTemplateNumber=86,totalNumberOfQuantiles=2 $sample2 $temp +$tools_dir/grib_set -s tablesVersion=31,productDefinitionTemplateNumber=86,totalNumberOfQuantiles=2 $sample2 $temp grib_check_key_equals $temp totalNumberOfQuantiles,quantileValue '2 0' @@ -148,6 +147,33 @@ grib_check_key_equals $temp perturbationNumber,typeOfStatisticalProcessing '2000 $tools_dir/grib_dump -O -p section_4 $temp > $tempText grep -q "Individual member for large ensemble forecast.*continuous or non-continuous interval" $tempText +# stepType & PDTNs +# -------------------- +test_PDTN_conversions() +{ + # Arguments + # $1 = product def template for instantaneous + # $2 = product def template for interval-based + pdtn_instant=$1 + pdtn_interval=$2 + $tools_dir/grib_set -s productDefinitionTemplateNumber=$pdtn_instant,stepType=accum $sample2 $temp + grib_check_key_equals $temp productDefinitionTemplateNumber $pdtn_interval + $tools_dir/grib_set -s stepType=instant $temp $temp1 + grib_check_key_equals $temp1 productDefinitionTemplateNumber $pdtn_instant +} + +test_PDTN_conversions 2 12 +test_PDTN_conversions 3 13 +test_PDTN_conversions 4 14 +test_PDTN_conversions 5 9 +test_PDTN_conversions 6 10 +test_PDTN_conversions 40 42 +test_PDTN_conversions 41 43 +# test_PDTN_conversions 45 85 # TODO +test_PDTN_conversions 57 67 +test_PDTN_conversions 58 68 +test_PDTN_conversions 71 73 + # Clean up rm -f $temp $temp1 $temp2 $tempFilt $tempText