mirror of https://github.com/ecmwf/eccodes.git
Testing: Check for duplicate parameter encodings
This commit is contained in:
parent
e4adcb2cf8
commit
66bfe1fbab
|
@ -37,19 +37,21 @@ check_grib_defs()
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
echo "Check for duplicate encodings"
|
echo "Check for duplicate encodings"
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
paramIdFile=$ECCODES_DEFINITION_PATH/grib2/paramId.def
|
paramIdFiles="$ECCODES_DEFINITION_PATH/grib2/paramId.def $ECCODES_DEFINITION_PATH/grib2/localConcepts/ecmf/paramId.def"
|
||||||
|
|
||||||
# Flatten the file so we get just the encoding part.
|
# Flatten the file so we get just the encoding part.
|
||||||
# uniq -d outputs a single copy of each line that is repeated in the input
|
# uniq -d outputs a single copy of each line that is repeated in the input
|
||||||
cat $paramIdFile | tr '\n' ' ' | tr '\t' ' ' | tr '#' '\n' | sed "s/^.* '//" | sed "s/'//" | awk '{$1="";print}' | sort |uniq -d > $tempText
|
for paramIdFile in $paramIdFiles; do
|
||||||
if [ -s "$tempText" ]; then
|
cat $paramIdFile | tr '\n' ' ' | tr '\t' ' ' | tr '#' '\n' | sed "s/^.* '//" | sed "s/'//" | awk '{$1="";print}' | sort |uniq -d > $tempText
|
||||||
# File exists and has a size greater than zero
|
if [ -s "$tempText" ]; then
|
||||||
echo "ERROR: Duplicate parameter encoding(s) found in $paramIdFile" >&2
|
# File exists and has a size greater than zero
|
||||||
cat $tempText | sed -e 's/ ;/;/g'
|
echo "ERROR: Duplicate parameter encoding(s) found in $paramIdFile" >&2
|
||||||
exit 1
|
cat $tempText | sed -e 's/ ;/;/g'
|
||||||
else
|
exit 1
|
||||||
echo "No duplicates in $paramIdFile"
|
else
|
||||||
fi
|
echo "No duplicates in $paramIdFile"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# First check the GRIB2 paramId.def and shortName.def
|
# First check the GRIB2 paramId.def and shortName.def
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue