Testing: Avoid comparing floats as strings (SD-88343)

This commit is contained in:
Shahram Najm 2024-01-11 17:25:52 +00:00
parent c35fdc2471
commit 52f6530493
3 changed files with 15 additions and 9 deletions

View File

@ -203,7 +203,7 @@ tropical_cyclone.bufr
tros_31.bufr
"
KEYS='localLongitude1,localLatitude1,localLongitude2,localLatitude2,localNumberOfObservations,satelliteID,restricted'
KEYS='typicalDate,localNumberOfObservations,satelliteID,restricted'
for bf in ${bufr_files}; do
input=${data_dir}/bufr/$bf
$EXEC ${test_dir}/bufr_extract_headers $KEYS $input > $temp1

View File

@ -31,18 +31,21 @@ fi
# --- Do I want to exclude any file pattern from the comparison ?
exclusion_pattern="tcw|ssr|str|skt|cap|ci|ttr|st|sm|sd|slhf|sshf"
# Some very small floating-point differences shown for these
blacklist="-b iDirectionIncrementInDegrees,jDirectionIncrementInDegrees"
for file in ${dir}/tigge_[a-e]*.grib; do
exclude=`echo $file | awk " /$exclusion_pattern/ {print \"found\";} "`
if [ -z "$exclude" ]; then
rm -f ${temp1} ${temp2}
# 2 to 1 conversion check
${tools_dir}/grib_set -s editionNumber=1 ${file} ${temp1} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_compare -P -c data:n,geography:n ${temp1} ${file} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_set -s editionNumber=1 ${file} ${temp1}
${tools_dir}/grib_compare $blacklist -P -c data:n,geography:n ${temp1} ${file}
# 1 to 2 conversion check
${tools_dir}/grib_set -s editionNumber=2 ${temp1} ${temp2} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_compare -P -c shortName,data:n,geography:n ${temp2} ${file} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_set -s editionNumber=2 ${temp1} ${temp2}
${tools_dir}/grib_compare $blacklist -P -c shortName,data:n,geography:n ${temp2} ${file}
fi
done

View File

@ -30,18 +30,21 @@ fi
# --- Do I want to exclude any file pattern from the comparison ?
exclusion_pattern="tcw|ssr|str|skt|cap|ci|ttr|st|sm|sd|slhf|sshf"
# Some very small floating-point differences shown for these
blacklist="-b iDirectionIncrementInDegrees,jDirectionIncrementInDegrees"
for file in ${dir}/tigge_[f-z]*.grib; do
exclude=`echo $file | awk " /$exclusion_pattern/ {print \"found\";} "`
if [ -z "$exclude" ]; then
rm -f ${temp1} ${temp2}
# 2 to 1 conversion check
${tools_dir}/grib_set -s editionNumber=1 ${file} ${temp1} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_compare -P -c data:n,geography:n ${temp1} ${file} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_set -s editionNumber=1 ${file} ${temp1}
${tools_dir}/grib_compare $blacklist -P -c data:n,geography:n ${temp1} ${file}
# 1 to 2 conversion check
${tools_dir}/grib_set -s editionNumber=2 ${temp1} ${temp2} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_compare -P -c shortName,data:n,geography:n ${temp2} ${file} 2> $REDIRECT > $REDIRECT
${tools_dir}/grib_set -s editionNumber=2 ${temp1} ${temp2}
${tools_dir}/grib_compare $blacklist -P -c shortName,data:n,geography:n ${temp2} ${file}
fi
done