Merge branch 'develop' of ssh://software.ecmwf.int:7999/eccodes/eccodes into develop

This commit is contained in:
Enrico Fucile 2016-07-06 10:56:02 +01:00
commit 0cb170163c
12 changed files with 89 additions and 13 deletions

View File

@ -287,6 +287,7 @@ libeccodes_la_prototypes= \
grib_dumper_class_debug.c \
grib_dumper_class_default.c \
grib_dumper_class_keys.c \
grib_dumper_class_filter.c \
grib_dumper_class_json.c \
grib_dumper_class_xml.c \
grib_dumper_class_c_code.c \

View File

@ -57,6 +57,7 @@ list( APPEND tests2
bufr_change_edition
ecc-197
ecc-286
ecc-288
gts_get
gts_ls
gts_compare

View File

@ -58,7 +58,10 @@ TESTS = definitions.sh \
ccsds.sh \
md5.sh \
grib_util_set_spec.sh \
neg_fctime.sh
neg_fctime.sh \
ecc-197.sh \
ecc-286.sh \
ecc-288.sh
# First download all the necessary data for testing
# Note: if download fails, no tests will be done

View File

@ -104,7 +104,7 @@ ${tools_dir}/bufr_compare -r ${fBufrInput1} ${fBufrInput2}>> $fLog
#----------------------------------------------------
${tools_dir}bufr_set -s subCentre=12 aaen_55.bufr $fBufrTmp
set +e
${tools_dir}bufr_compare aaen_55.bufr $fBufrTmp
${tools_dir}bufr_compare aaen_55.bufr $fBufrTmp >/dev/null
status=$?
set -e
[ $status -eq 1 ]
@ -116,7 +116,7 @@ temp_dir=tempdir.bufr_compare
mkdir -p $temp_dir
infile=aaen_55.bufr
cp $infile $temp_dir
${tools_dir}bufr_compare $infile $temp_dir
${tools_dir}bufr_compare $infile $temp_dir >/dev/null
#Clean up

View File

@ -15,7 +15,7 @@ label="bufr_dump_test"
#Create log file
fLog=${label}".log"
rm -f $fLog | true
rm -f $fLog
touch $fLog
#Define tmp bufr files
@ -70,3 +70,4 @@ done
#rm -f $fLog
#rm -f $fJsonTmp | true
rm -f $fLog

View File

@ -1425,3 +1425,4 @@ do
done
rm -f $fLog

View File

@ -41,14 +41,11 @@ ref_get=$f".ls.ref"
echo "Test: -p switch" >> $fLog
echo "file: $f" >> $fLog
${tools_dir}/bufr_get -p totalLength,bufrHeaderCentre,bufrHeaderSubCentre,masterTableNumber,masterTablesVersionNumber,localTablesVersionNumber,numberOfSubsets,numberOfObservations $f > $fTmp
${tools_dir}/bufr_get -p totalLength,bufrHeaderCentre,bufrHeaderSubCentre,masterTableNumber,masterTablesVersionNumber,localTablesVersionNumber,numberOfSubsets,localNumberOfObservations $f > $fTmp
#Write the values into a file and compare with ref
cat $fTmp | awk '{split($0,a," "); for (i=1; i<=8; i++) print a[i]}' > $res_get
diff $ref_get $res_get
#Clean up
rm -f $fLog
rm -f $fTmp | true
rm -f $res_get | true
rm -f $fLog $fTmp $res_get

View File

@ -42,7 +42,7 @@ ref_ls=$f".ls.ref"
res_ls=$f".ls.test"
REDIRECT=/dev/null
${tools_dir}/bufr_ls -p totalLength,bufrHeaderCentre,bufrHeaderSubCentre,masterTableNumber,masterTablesVersionNumber,localTablesVersionNumber,numberOfSubsets,numberOfObservations $f 2> $REDIRECT > $fTmp
${tools_dir}/bufr_ls -p totalLength,bufrHeaderCentre,bufrHeaderSubCentre,masterTableNumber,masterTablesVersionNumber,localTablesVersionNumber,numberOfSubsets,localNumberOfObservations $f 2> $REDIRECT > $fTmp
#Write the values into a file and compare with ref
awk NR==3 $fTmp | awk '{split($0,a," "); for (i=1; i<=8; i++) print a[i]}' > $res_ls

View File

@ -15,9 +15,17 @@
# It tests decoding a BUFR file which cannot be done unless
# we extend the definitions to include extra files
# ---------------------------------------------------------
label="ecc-197-test"
input=${data_dir}/bufr/vos308014_v3_26.bufr
if [ ! -f $input ]; then
echo "Data file $input not available"
exit 0
fi
TEMP=${label}.temp
# Create a temporary directory which holds the tables etc
TEMP_DIR=ecc-197-temp-dir.$$
TEMP_DIR=${label}.temp-dir.$$
rm -rf $TEMP_DIR
mkdir -p $TEMP_DIR/definitions/bufr/tables/0/wmo/26
@ -32,7 +40,11 @@ MY_DEFS=`pwd`/$TEMP_DIR/definitions
export ECCODES_DEFINITION_PATH=$MY_DEFS:$ECCODES_DEFINITION_PATH
# Now decode
${tools_dir}bufr_dump ${data_dir}/bufr/vos308014_v3_26.bufr >/dev/null
${tools_dir}bufr_dump $input > $TEMP
# Ensure output JSON has all the expected contents
# After calling 'wc' and 'set', $1 will be the line count
set `wc -l $TEMP`
[ "$1" = "35725" ]
rm -rf $TEMP_DIR
rm -f $TEMP

42
tests/ecc-288.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/sh
# Copyright 2005-2016 ECMWF.
#
# 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.
#
# 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.
#
. ./include.sh
# ---------------------------------------------------------
# This is the test for the JIRA issue ECC-288
# It tests bufr_compare with a relative tolerance
# ---------------------------------------------------------
cd ${data_dir}/bufr
label="ecc_288_test"
tempRules=temp.${label}.filter
tempOut=temp.${label}.out
BufrFile=syno_1.bufr
cat > $tempRules <<EOF
set localLongitude=151.831;
write;
EOF
${tools_dir}bufr_filter -o $tempOut $tempRules $BufrFile
# There is a difference in localLongitude, rel error=6.58627e-06
# So this should fail
set +e
${tools_dir}bufr_compare $tempOut $BufrFile
status=$?
set -e
[ $status -eq 1 ]
# Now apply the option and now it should pass
${tools_dir}bufr_compare -R localLongitude=6.59e-06 $tempOut $BufrFile
rm -rf $tempOut $tempRules

View File

@ -313,6 +313,16 @@ int grib_tool_init(grib_runtime_options* options)
if (grib_options_on("t:"))
tolerance_factor=atof(grib_options_get_option("t:"));
if (grib_options_on("R:")) {
char* sarg=grib_options_get_option("R:");
options->tolerance_count=MAX_KEYS;
ret=parse_keyval_string(grib_tool_name, sarg,1,GRIB_TYPE_DOUBLE,options->tolerance,&(options->tolerance_count));
if (ret == GRIB_INVALID_ARGUMENT) {
usage();
exit(1);
}
}
{
/* Check for 2nd file being a directory. If so, we assume user is comparing to a file */
/* with the same name as first file in that directory */

View File

@ -420,6 +420,10 @@
RelativePath="..\..\..\src\action_class_write.c"
>
</File>
<File
RelativePath="..\..\..\src\codes_memfs.c"
>
</File>
<File
RelativePath="..\..\..\src\compile.c"
>
@ -1388,6 +1392,10 @@
RelativePath="..\..\..\src\grib_dumper_class_default.c"
>
</File>
<File
RelativePath="..\..\..\src\grib_dumper_class_filter.c"
>
</File>
<File
RelativePath="..\..\..\src\grib_dumper_class_json.c"
>