Testing: unalias directive (in preparation for ECC-1898)

This commit is contained in:
shahramn 2024-08-15 10:58:23 +01:00
parent 9235522326
commit a12b890e9c
1 changed files with 80 additions and 1 deletions

View File

@ -11,7 +11,9 @@
. ./include.ctest.sh . ./include.ctest.sh
label="grib_mars_keys2_test" label="grib_mars_keys2_test"
tempOut=temp.${label}.out
tempGrib=temp.${label}.grib tempGrib=temp.${label}.grib
tempRef=temp.${label}.ref
grib1_sample=$ECCODES_SAMPLES_PATH/GRIB1.tmpl grib1_sample=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
grib2_sample=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl grib2_sample=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl
@ -27,6 +29,82 @@ grib_check_key_equals $tempGrib mars.class,mars.type,mars.stream 'yt em dcwv'
grib_check_key_equals $tempGrib marsClass:i,marsType:i,marsStream:i '18 17 1029' grib_check_key_equals $tempGrib marsClass:i,marsType:i,marsStream:i '18 17 1029'
# Check unalias
# -----------------
${tools_dir}/grib_set -s stream=gfas,type=ga $grib2_sample $tempGrib
${tools_dir}/grib_ls -jm $tempGrib > $tempOut
cat > $tempRef << EOF
{ "messages" : [
{
"domain": "g",
"date": 20100912,
"time": 1200,
"expver": "0001",
"class": "od",
"type": "ga",
"stream": "gfas",
"step": 0,
"levelist": 1000,
"levtype": "pl",
"param": 130
}
]}
EOF
diff $tempRef $tempOut
# This combo unaliases mars.levelist and mars.step
${tools_dir}/grib_set -s stream=gfas,type=gsd $grib2_sample $tempGrib
${tools_dir}/grib_ls -jm $tempGrib > $tempOut
cat > $tempRef << EOF
{ "messages" : [
{
"domain": "g",
"date": 20100912,
"time": 1200,
"expver": "0001",
"class": "od",
"type": "gsd",
"stream": "gfas",
"param": 130
}
]}
EOF
diff $tempRef $tempOut
${tools_dir}/grib_dump -Da $grib2_sample > $tempOut
grep -q "g2level level = 1000 .vertical.level, mars.levelist" $tempOut
${tools_dir}/grib_dump -Da $tempGrib > $tempOut
set +e
grep -w levelist $tempOut # dump should not show levelist
status=$?
set -e
[ $status -ne 0 ]
# GRIB1
# This combo unaliases mars.step
${tools_dir}/grib_set -s localDefinitionNumber=31,stream=esmm,type=em $grib1_sample $tempGrib
${tools_dir}/grib_ls -jm $tempGrib > $tempOut
cat > $tempRef << EOF
{ "messages" : [
{
"domain": "g",
"levtype": "pl",
"levelist": 500,
"time": 1200,
"param": 129.128,
"class": "od",
"type": "em",
"stream": "esmm",
"expver": "0001",
"fcmonth": 0,
"date": 0
}
]}
EOF
diff $tempRef $tempOut
# Check all combinations # Check all combinations
# ------------------------ # ------------------------
i=0 i=0
@ -43,5 +121,6 @@ for cfg in $ECCODES_DEFINITION_PATH/mars/grib.*.*.def; do
done done
echo "Checked $i files" echo "Checked $i files"
# Clean up # Clean up
rm -f $tempGrib rm -f $tempGrib $tempRef $tempOut