Merge branch 'bugfix/ECC-1230--Conversion' into develop

This commit is contained in:
Shahram Najm 2021-04-15 12:42:05 +01:00
commit 15d2f906d9
3 changed files with 55 additions and 1 deletions

View File

@ -319,7 +319,12 @@ alias time.stepType=stepType;
# ECC-457: GRIB1 to GRIB2 conversion
concept_nofail stepTypeForConversion (unknown, "stepTypeForConversion.def", conceptsDir2, conceptsDir1);
if (stepTypeForConversion is "accum" ) {
alias productDefinitionTemplateNumber=eight;
if (productDefinitionTemplateNumber == 1) {
alias productDefinitionTemplateNumber=eleven;
}
else {
alias productDefinitionTemplateNumber=eight;
}
}
meta md5Section1 md5(offsetSection1,section1Length);

View File

@ -82,6 +82,7 @@ if( HAVE_BUILD_TOOLS )
grib_ecc-1170
grib_ecc-1195
grib_ecc-1212
grib_ecc-1230
bufr_ecc-1195
bufr_json_samples
bufr_ecc-359

48
tests/grib_ecc-1230.sh Executable file
View File

@ -0,0 +1,48 @@
#!/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="prod_ECC-1230-test"
temp1=temp1.$label
temp2=temp2.$label
sample_grib1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
# paramId 228 is "Total precipitation" (=tp)
# ------------------------------------------
${tools_dir}/grib_set -s \
type=pf,localDefinitionNumber=30,stream=enfo,\
perturbationNumber=10,numberOfForecastsInEnsemble=51,indicatorOfParameter=228 \
$sample_grib1 $temp1
grib_check_key_equals $temp1 "stepTypeForConversion" "accum"
grib_check_key_equals $temp1 "paramId,shortName,productDefinitionTemplateNumber" "228 tp 11"
# Convert
${tools_dir}/grib_set -s edition=2 $temp1 $temp2
grib_check_key_equals $temp2 "productDefinitionTemplateNumber" "11"
grib_check_key_equals $temp2 "numberOfForecastsInEnsemble,perturbationNumber" "51 10"
# Now check 2m temperature (not accumulated)
# ------------------------------------------
${tools_dir}/grib_set -s \
type=pf,localDefinitionNumber=30,stream=enfo,\
perturbationNumber=10,numberOfForecastsInEnsemble=51,shortName=2t \
$sample_grib1 $temp1
grib_check_key_equals $temp1 "productDefinitionTemplateNumber" "1"
# Convert
${tools_dir}/grib_set -s edition=2 $temp1 $temp2
grib_check_key_equals $temp2 "productDefinitionTemplateNumber" "1"
grib_check_key_equals $temp2 "numberOfForecastsInEnsemble,perturbationNumber" "51 10"
# Clean up
rm -f $temp1 $temp2