ECC-1806: Further tests

This commit is contained in:
shahramn 2024-04-19 18:21:30 +01:00
parent a39eb883cd
commit ce791332a5
2 changed files with 43 additions and 13 deletions

View File

@ -328,7 +328,18 @@ meta md5Product md5(offsetSection1,section1Length,gridDefinition,section1Flags,d
# ECC-1806
concept_nofail paramIdForConversion(zero) {
262000 = { gribTablesVersionNo=174;indicatorOfParameter=98; centre=98; } # 174098 -> 262000
262104 = { gribTablesVersionNo=151;indicatorOfParameter=163;centre=98; } # 151163 -> 262104
262124 = { gribTablesVersionNo=151;indicatorOfParameter=145;centre=98; } # 151145 -> 262124
228004 = { gribTablesVersionNo=128; indicatorOfParameter=55; centre=98; } # 55 -> 228004
235168 = { gribTablesVersionNo=128; indicatorOfParameter=56; centre=98; } # 56 -> 235168
235135 = { gribTablesVersionNo=130; indicatorOfParameter=232; centre=98; } # 130232 -> 235135
262104 = { gribTablesVersionNo=151; indicatorOfParameter=163; centre=98; } # 151163 -> 262104
262124 = { gribTablesVersionNo=151; indicatorOfParameter=145; centre=98; } # 151145 -> 262124
235033 = { gribTablesVersionNo=172; indicatorOfParameter=146; centre=98; } # 172146 -> 235033
235034 = { gribTablesVersionNo=172; indicatorOfParameter=147; centre=98; } # 172147 -> 235034
235035 = { gribTablesVersionNo=172; indicatorOfParameter=169; centre=98; } # 172169 -> 235035
235036 = { gribTablesVersionNo=172; indicatorOfParameter=175; centre=98; } # 172175 -> 235036
235037 = { gribTablesVersionNo=172; indicatorOfParameter=176; centre=98; } # 172176 -> 235037
235038 = { gribTablesVersionNo=172; indicatorOfParameter=177; centre=98; } # 172177 -> 235038
235039 = { gribTablesVersionNo=172; indicatorOfParameter=178; centre=98; } # 172178 -> 235039
235040 = { gribTablesVersionNo=172; indicatorOfParameter=179; centre=98; } # 172179 -> 235040
262000 = { gribTablesVersionNo=174; indicatorOfParameter=98; centre=98; } # 174098 -> 262000
} : long_type;

View File

@ -13,11 +13,9 @@
REDIRECT=/dev/null
label="grib_ecc-1806_test"
tempGribA=temp.$label.1.grib
tempGribB=temp.$label.2.grib
tempFilt=temp.$label.filt
tempGrib1=temp.$label.1.grib
tempGrib2=temp.$label.2.grib
tempLog=temp.$label.log
tempRef=temp.$label.ref
sample_grib1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
@ -27,21 +25,42 @@ test_conversion()
param1=$1 # old paramId in GRIB1
param2=$2 # new paramId in GRIB2
short=$3 # new shortName
${tools_dir}/grib_set -s paramId=$param1,edition=2 $sample_grib1 $tempGribA
grib_check_key_equals $tempGribA paramId,shortName "$param2 $short"
# The old paramId has been removed from GRIB2
${tools_dir}/grib_set -s paramId=$param1 $sample_grib1 $tempGrib1
set +e
${tools_dir}/grib_set -s paramId=$param1 $sample_grib2 $tempGribA 2>$REDIRECT
${tools_dir}/grib_set -s edition=2 $tempGrib1 $tempGrib2 2>$REDIRECT
status=$?
set -e
if [ $status -ne 0 ]; then
${tools_dir}/grib_set -s stepType=avg,edition=2 $tempGrib1 $tempGrib2
fi
grib_check_key_equals $tempGrib2 paramId,shortName "$param2 $short"
# Check the old paramId has been removed from GRIB2
set +e
${tools_dir}/grib_set -s paramId=$param1 $sample_grib2 $tempGrib2 >$tempLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "no match for paramId" $tempLog
}
test_conversion 174098 262000 sithick
test_conversion 151163 262104 t20d
test_conversion 151145 262124 zos
test_conversion 130232 235135 mw
test_conversion 172146 235033 msshf
test_conversion 172147 235034 mslhf
test_conversion 55 228004 mean2t
test_conversion 56 235168 m2d
test_conversion 172169 235035 msdwswrf
test_conversion 172175 235036 msdwlwrf
test_conversion 172176 235037 msnswrf
test_conversion 172177 235038 msnlwrf
test_conversion 172178 235039 mtnswrf
test_conversion 172179 235040 mtnlwrf
# Clean up
rm -f $tempGribA $tempGribB $tempFilt $tempLog $tempRef
rm -f $tempGrib1 $tempGrib2 $tempLog