ECC-1954: Test

This commit is contained in:
shahramn 2024-10-29 16:26:56 +00:00
parent df2b452ff1
commit f9561ed7d4
2 changed files with 20 additions and 5 deletions

View File

@ -335,6 +335,7 @@ meta md5Product md5(offsetSection1,section1Length,gridDefinition,section1Flags,d
# ECC-1806 # ECC-1806
concept_nofail paramIdForConversion(zero, "paramIdForConversion.def", conceptsDir2, conceptsDir1) : long_type,read_only; concept_nofail paramIdForConversion(zero, "paramIdForConversion.def", conceptsDir2, conceptsDir1) : long_type,read_only;
# ECC-1954
if (productDefinitionTemplateNumber == 0 && defined(perturbationNumber) && numberOfForecastsInEnsemble > 0) { if (productDefinitionTemplateNumber == 0 && defined(perturbationNumber) && numberOfForecastsInEnsemble > 0) {
alias productDefinitionTemplateNumber = one; # ensemble instant alias productDefinitionTemplateNumber = one; # ensemble instant
} }

View File

@ -11,6 +11,7 @@
. ./include.ctest.sh . ./include.ctest.sh
REDIRECT=/dev/null REDIRECT=/dev/null
label="grib1to2_test"
files="constant_field\ files="constant_field\
reduced_gaussian_pressure_level_constant \ reduced_gaussian_pressure_level_constant \
@ -29,6 +30,8 @@ files="constant_field\
spherical_pressure_level \ spherical_pressure_level \
spherical_model_level " spherical_model_level "
tempLog=temp.$label.log
for f in `echo $files` for f in `echo $files`
do do
file=${data_dir}/$f file=${data_dir}/$f
@ -53,7 +56,7 @@ done
echo "ECC-457,ECC-1298 ECMWF total precipitation..." echo "ECC-457,ECC-1298 ECMWF total precipitation..."
# --------------------------------------------------- # ---------------------------------------------------
input=${data_dir}/tp_ecmwf.grib input=${data_dir}/tp_ecmwf.grib
output=temp.grib1to2.grib output=temp.$label.grib
${tools_dir}/grib_set -s edition=2 $input $output ${tools_dir}/grib_set -s edition=2 $input $output
res=`${tools_dir}/grib_get -w count=1 -p edition,paramId,units $output` res=`${tools_dir}/grib_get -w count=1 -p edition,paramId,units $output`
[ "$res" = "2 228 m" ] [ "$res" = "2 228 m" ]
@ -93,8 +96,8 @@ grib_check_key_equals $output shapeOfTheEarth 0
echo "ECC-1329: Cannot convert runoff (paramId=205)" echo "ECC-1329: Cannot convert runoff (paramId=205)"
# -------------------------------------------------------- # --------------------------------------------------------
temp1="temp1.grib1to2.grib1" temp1="temp1.$label.grib1"
temp2="temp2.grib1to2.grib2" temp2="temp2.$label.grib2"
${tools_dir}/grib_set -s paramId=205,P1=240,marsType=fc $sample_g1 $temp1 ${tools_dir}/grib_set -s paramId=205,P1=240,marsType=fc $sample_g1 $temp1
${tools_dir}/grib_set -s edition=2 $temp1 $temp2 ${tools_dir}/grib_set -s edition=2 $temp1 $temp2
grib_check_key_equals $temp2 discipline,stepType,shortName,paramId '2 accum ro 205' grib_check_key_equals $temp2 discipline,stepType,shortName,paramId '2 accum ro 205'
@ -111,10 +114,20 @@ for sn in e lsp pev sro uvb; do
${tools_dir}/grib_compare -e -b param $temp1 $temp2 ${tools_dir}/grib_compare -e -b param $temp1 $temp2
done done
echo "ECC-1954: preserve ensemble product template..."
# --------------------------------------------------------
${tools_dir}/grib_set -s \
indicatorOfParameter=49,P2=1,timeRangeIndicator=2,localDefinitionNumber=30,perturbationNumber=1,numberOfForecastsInEnsemble=51 \
$sample_g1 $temp1
${tools_dir}/grib_set -s edition=2 $temp1 $temp2
grib_check_key_equals $temp2 productDefinitionTemplateNumber,perturbationNumber '11 1'
# Turn on (brief) DEBUGGING messages # Turn on (brief) DEBUGGING messages
sample_g1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl sample_g1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
output=temp.grib1to2.grib output=temp.$label.grib
ECCODES_DEBUG=-1 ${tools_dir}/grib_set -s edition=2 $sample_g1 $output ECCODES_DEBUG=-1 ${tools_dir}/grib_set -s edition=2 $sample_g1 $output > $tempLog 2>&1
# -G option # -G option
sample_g1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl sample_g1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
@ -124,3 +137,4 @@ ${tools_dir}/grib_set -G -s edition=2 $sample_g1 $temp2
# Clean up # Clean up
rm -f $output rm -f $output
rm -f $temp1 $temp2 rm -f $temp1 $temp2
rm -f $tempLog