|
| 1 | +#!/bin/sh |
| 2 | +# (C) Copyright 2005- ECMWF. |
| 3 | +# |
| 4 | +# This software is licensed under the terms of the Apache Licence Version 2.0 |
| 5 | +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 6 | +# |
| 7 | +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by |
| 8 | +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. |
| 9 | +# |
| 10 | + |
| 11 | +. ./include.ctest.sh |
| 12 | + |
| 13 | +# --------------------------------------------------------- |
| 14 | +# This is the test for JIRA issue ECC-2230 |
| 15 | +# GRIB2: Potential rounding bug in the 'wavelength' key |
| 16 | +# --------------------------------------------------------- |
| 17 | + |
| 18 | +label=`basename $0 | sed -e 's/\.sh/_test/'` |
| 19 | + |
| 20 | +if [ $ECCODES_ON_WINDOWS -eq 1 ]; then |
| 21 | + echo "$0: This test is currently disabled on Windows" |
| 22 | + exit 0 |
| 23 | +fi |
| 24 | + |
| 25 | +tempGrib=temp.$label.grib |
| 26 | +tempFilt=temp.$label.filt |
| 27 | +tempLog=temp.$label.log |
| 28 | +tempOut=temp.$label.txt |
| 29 | +tempRef=temp.$label.ref |
| 30 | + |
| 31 | +sample_grib2=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl |
| 32 | +cat >$tempFilt<<EOF |
| 33 | + set class = 'mc'; |
| 34 | + set tablesVersion = 35; |
| 35 | + set productDefinitionTemplateNumber = 48; |
| 36 | + set paramId = 457000; |
| 37 | + set typeOfSizeInterval = 3; |
| 38 | + set scaleFactorOfFirstSize = 0; |
| 39 | + set scaledValueOfFirstSize = 0; |
| 40 | + set typeOfWavelengthInterval = 11; |
| 41 | + set scaleFactorOfFirstWavelength = 9; |
| 42 | + set scaledValueOfFirstWavelength = 469; |
| 43 | + set enableChemSplit = 1; |
| 44 | + set chemId = 922; |
| 45 | + write; |
| 46 | +EOF |
| 47 | +${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample_grib2 |
| 48 | +result=$( ${tools_dir}/grib_get -p wavelength:d -F%.15f $tempGrib ) |
| 49 | +[ "$result" = "469.000000000000000" ] || exit 1 |
| 50 | + |
| 51 | +grib_check_key_equals $tempGrib "wavelength" "469" |
| 52 | + |
| 53 | +# Clean up |
| 54 | +rm -f $tempGrib $tempFilt $tempLog $tempOut $tempRef |
0 commit comments