eccodes/tests/grib_tigge_conversions2.sh

52 lines
1.6 KiB
Bash
Raw Permalink Normal View History

2013-03-25 12:04:10 +00:00
#!/bin/sh
2020-01-28 14:32:34 +00:00
# (C) Copyright 2005- ECMWF.
2013-03-25 12:04:10 +00:00
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
2013-03-25 14:23:07 +00:00
#
2013-03-25 12:04:10 +00:00
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
# --- test grib edition 2 to 1 conversions with tigge data
# --- using the new features of grib_compare that allows
# --- namespace comparison
. ./include.ctest.sh
2013-03-25 12:04:10 +00:00
REDIRECT=/dev/null
2022-07-22 16:57:02 +00:00
label="grib_tigge_conv2_test"
2020-07-16 16:44:48 +00:00
dir="${data_dir}/tigge"
temp1="temp.${label}.grib1_"
temp2="temp.${label}.grib2_"
2013-03-25 12:04:10 +00:00
2024-01-09 13:13:32 +00:00
if [ $ECCODES_ON_WINDOWS -eq 1 ]; then
echo "$0: This test is currently disabled on Windows"
exit 0
fi
2013-03-25 12:04:10 +00:00
# --- 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"
2013-03-25 12:04:10 +00:00
# ECC-1744: Some very small floating-point differences shown for these
blacklist="-b iDirectionIncrementInDegrees,jDirectionIncrementInDegrees"
for file in ${dir}/tigge_[f-z]*.grib; do
2017-11-30 17:49:46 +00:00
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}
${tools_dir}/grib_compare $blacklist -P -c data:n,geography:n ${temp1} ${file}
2017-11-30 17:49:46 +00:00
# 1 to 2 conversion check
${tools_dir}/grib_set -s editionNumber=2 ${temp1} ${temp2}
${tools_dir}/grib_compare $blacklist -P -c shortName,data:n,geography:n ${temp2} ${file}
2017-11-30 17:49:46 +00:00
fi
2013-03-25 12:04:10 +00:00
done
2017-11-30 17:49:46 +00:00
rm -f ${temp1} ${temp2}