diff --git a/data/bufr/CMakeLists.txt b/data/bufr/CMakeLists.txt index d296aadbf..f81689249 100644 --- a/data/bufr/CMakeLists.txt +++ b/data/bufr/CMakeLists.txt @@ -13,7 +13,6 @@ STRING(REGEX REPLACE "\n" ";" bufr_refs_to_download "${bufr_refs_to_download}") # Exceptional case: download bufr files which have to be treated specially LIST(APPEND bufr_refs_to_download "vos308014_v3_26.bufr") # See test ecc-197 -LIST(APPEND bufr_refs_to_download "israel_observations_2017041010.bufr") # See test ecc-313 ecbuild_get_test_multidata( TARGET eccodes_download_bufrs diff --git a/data/bufr/bufr_data_files.txt b/data/bufr/bufr_data_files.txt index 84016a48c..285f94b17 100644 --- a/data/bufr/bufr_data_files.txt +++ b/data/bufr/bufr_data_files.txt @@ -143,3 +143,4 @@ srals3_eumetsat.bufr eumetsat_iasi_co.bufr eum_iasi_twt.bufr delayed_repl_01.bufr +israel_observations_2017041010.bufr diff --git a/src/grib_accessor_class_bufr_data_array.c b/src/grib_accessor_class_bufr_data_array.c index 8e70af2ed..02297db36 100644 --- a/src/grib_accessor_class_bufr_data_array.c +++ b/src/grib_accessor_class_bufr_data_array.c @@ -2613,10 +2613,10 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start case 3: /* Change reference values */ - //if (flag != PROCESS_DECODE) { - // grib_context_log(c,GRIB_LOG_ERROR,"process_elements: operator %d supported for decoding only",descriptors[i]->X); - // return GRIB_INTERNAL_ERROR; - //} + if (self->compressedData == 1 && flag != PROCESS_DECODE) { + grib_context_log(c,GRIB_LOG_ERROR,"process_elements: operator %d not supported for encoding compressed data",descriptors[i]->X); + return GRIB_INTERNAL_ERROR; + } if (descriptors[i]->Y == 255) { grib_context_log(c, GRIB_LOG_DEBUG,"Operator 203YYY: Y=255, definition of new reference values is concluded"); self->change_ref_value_operand = 255; diff --git a/src/grib_dumper_class_bufr_decode_C.c b/src/grib_dumper_class_bufr_decode_C.c index 7978ada92..d910b4ae6 100644 --- a/src/grib_dumper_class_bufr_decode_C.c +++ b/src/grib_dumper_class_bufr_decode_C.c @@ -618,7 +618,8 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso _dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor"); _dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor"); _dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor"); - _dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues"); + /* Do not show the overriddenReferenceValues array. That's more for ENCODING */ + /*_dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues");*/ grib_dump_accessors_block(d,block); depth-=2; } else if (!grib_inline_strcmp(a->name,"groupNumber")) { diff --git a/src/grib_dumper_class_bufr_decode_filter.c b/src/grib_dumper_class_bufr_decode_filter.c index 50cb0b419..31febb4dd 100644 --- a/src/grib_dumper_class_bufr_decode_filter.c +++ b/src/grib_dumper_class_bufr_decode_filter.c @@ -529,7 +529,8 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso _dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor"); _dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor"); _dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor"); - _dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues"); + /* Do not show the overriddenReferenceValues array. That's more for ENCODING */ + /*_dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues");*/ grib_dump_accessors_block(d,block); depth-=2; } else if (!grib_inline_strcmp(a->name,"groupNumber")) { diff --git a/src/grib_dumper_class_bufr_decode_fortran.c b/src/grib_dumper_class_bufr_decode_fortran.c index f539d7843..d6801e544 100644 --- a/src/grib_dumper_class_bufr_decode_fortran.c +++ b/src/grib_dumper_class_bufr_decode_fortran.c @@ -555,7 +555,8 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso _dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor"); _dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor"); _dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor"); - _dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues"); + /* Do not show the overriddenReferenceValues array. That's more for ENCODING */ + /* _dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues"); */ grib_dump_accessors_block(d,block); depth-=2; } else if (!grib_inline_strcmp(a->name,"groupNumber")) { diff --git a/src/grib_dumper_class_bufr_decode_python.c b/src/grib_dumper_class_bufr_decode_python.c index a6ae816f1..2e3968d72 100644 --- a/src/grib_dumper_class_bufr_decode_python.c +++ b/src/grib_dumper_class_bufr_decode_python.c @@ -567,7 +567,8 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso _dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor"); _dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor"); _dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor"); - _dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues"); + /* Do not show the overriddenReferenceValues array. That's more for ENCODING */ + /* _dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues"); */ grib_dump_accessors_block(d,block); depth-=2; } else if (!grib_inline_strcmp(a->name,"groupNumber")) { diff --git a/src/grib_dumper_class_bufr_simple.c b/src/grib_dumper_class_bufr_simple.c index f96ce5877..11acc4d7d 100644 --- a/src/grib_dumper_class_bufr_simple.c +++ b/src/grib_dumper_class_bufr_simple.c @@ -690,7 +690,8 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso _dump_long_array(h,self->dumper.out,"delayedDescriptorReplicationFactor","inputDelayedDescriptorReplicationFactor"); _dump_long_array(h,self->dumper.out,"shortDelayedDescriptorReplicationFactor","inputShortDelayedDescriptorReplicationFactor"); _dump_long_array(h,self->dumper.out,"extendedDelayedDescriptorReplicationFactor","inputExtendedDelayedDescriptorReplicationFactor"); - _dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues"); + /* Do not show the overriddenReferenceValues array. That's more for ENCODING */ + /*_dump_long_array(h,self->dumper.out,"overriddenReferenceValues","overriddenReferenceValues");*/ grib_dump_accessors_block(d,block); depth-=2; } else if (!grib_inline_strcmp(a->name,"groupNumber")) { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 58d696a56..6214de6ed 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -80,6 +80,7 @@ list( APPEND tests_data_reqd bufr_ecc-286 bufr_ecc-288 bufr_ecc-313 + bufr_ecc-616 bufr_ecc-379 bufr_ecc-393 bufr_ecc-433 diff --git a/tests/bufr_dump_encode_filter.sh b/tests/bufr_dump_encode_filter.sh index d85ad64cb..36218d52f 100755 --- a/tests/bufr_dump_encode_filter.sh +++ b/tests/bufr_dump_encode_filter.sh @@ -37,7 +37,14 @@ fRules=${label}.filter #----------------------------------------------------------- files=`cat ${data_dir}/bufr/bufr_data_files.txt` -exclude="ias1_240.bufr syno_multi.bufr tropical_cyclone.bufr" +# Exclude BUFR files for various reasosn: +# ias1_240.bufr: Too large. The filter rules file generated is too big for the parser! +# tropical_cyclone.bufr: multi-message +# syno_multi.bufr: multi-message +# israel_observations_2017041010.bufr: Suffers from a bug. In filter cannot do: +# set #1#3HourPressureChange=-1.6; +# The hash cannot be followed by a number! +exclude="ias1_240.bufr syno_multi.bufr tropical_cyclone.bufr israel_observations_2017041010.bufr" for f in $files do diff --git a/tests/bufr_ecc-313.sh b/tests/bufr_ecc-313.sh index 618a9acb0..877aa1d57 100755 --- a/tests/bufr_ecc-313.sh +++ b/tests/bufr_ecc-313.sh @@ -13,8 +13,6 @@ # --------------------------------------------------------- # This is the test for the JIRA issue ECC-313. # It tests decoding a BUFR file which uses the operator 203YYY. -# Currently we cannot ENCODE with this operator. This test is -# for DECODING only # --------------------------------------------------------- label="bufr_ecc-313-test" tempRules=temp.${label}.filter @@ -36,6 +34,7 @@ cat > $tempRules <reference]"; EOF ${tools_dir}/codes_bufr_filter $tempRules $input > $tempOut @@ -64,9 +63,10 @@ h2=11 -1e+100 -1e+100 -1e+100 -1e+100 -1e+100 -1e+100 -1e+100 -1e+100 -1e+100 -1e+100 -1e+100 -1e+100 938 -1e+100 -1e+100 -1e+100 -1e+100 rv=-5000 -5000 +rf1=-5000 EOF - +echo "Expected output:" +cat $tempRef diff $tempRef $tempOut - rm -f $tempRules $tempRef $tempOut diff --git a/tests/bufr_ecc-616.sh b/tests/bufr_ecc-616.sh new file mode 100755 index 000000000..44c193bd3 --- /dev/null +++ b/tests/bufr_ecc-616.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# Copyright 2005-2018 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-616. +# It tests encoding a BUFR file which uses the operator 203YYY. +# --------------------------------------------------------- +label="bufr_ecc-616-test" +tempRules=temp.${label}.filter +tempOut=temp.${label}.txt +tempRef=temp.${label}.ref +tempBufr=temp.${label}.bufr + +input=${data_dir}/bufr/israel_observations_2017041010.bufr + +cat > $tempRules < $tempRules <ref=[heightOfStationGroundAboveMeanSeaLevel->reference]"; +EOF + +${tools_dir}/codes_bufr_filter $tempRules $tempBufr > $tempOut + +cat > $tempRef << EOF + numSubs=1 + refVals={-5000,-5000} + height=-415 + height->ref=-5000 +EOF +echo "Expected output:" +cat $tempRef +diff $tempRef $tempOut + +rm -f $tempRules $tempRef $tempOut $tempBufr