diff --git a/src/grib_accessor_class_bufr_data_array.c b/src/grib_accessor_class_bufr_data_array.c index 3d4175371..aa7a9b901 100644 --- a/src/grib_accessor_class_bufr_data_array.c +++ b/src/grib_accessor_class_bufr_data_array.c @@ -600,6 +600,7 @@ static grib_darray* decode_double_array(grib_context* c,unsigned char* data,long unsigned long lval; int localReference,localWidth,modifiedWidth,modifiedReference; double modifiedFactor,dval; + int bufr_multi_element_constant_arrays = c->bufr_multi_element_constant_arrays; *err=0; @@ -649,7 +650,13 @@ static grib_darray* decode_double_array(grib_context* c,unsigned char* data,long } else { dval=localReference*modifiedFactor; } - if(c->bufr_multi_element_constant_arrays) { + + /* dataPresentIndicator is special and has to have SINGLE VALUE if constant array */ + if (bufr_multi_element_constant_arrays == 1 && bd->code == 31031) { + bufr_multi_element_constant_arrays=0; + } + + if(bufr_multi_element_constant_arrays) { grib_context_log(c, GRIB_LOG_DEBUG," modifiedWidth=%ld lval=%ld dval=%g (const array multi values)", modifiedWidth,lval,dval,bd->code); for (j=0;jnumberOfSubsets;j++) { grib_darray_push(c,ret,dval); diff --git a/tests/bufr_ecc-428.sh b/tests/bufr_ecc-428.sh index 6fedc25df..b0706aa28 100755 --- a/tests/bufr_ecc-428.sh +++ b/tests/bufr_ecc-428.sh @@ -21,6 +21,7 @@ label="bufr_ecc_428_test" tempRules=temp.${label}.filter tempText=temp.${label}.text +tempErrs=temp.${label}.errs tempRef1=temp.${label}.ref1 tempRef2=temp.${label}.ref2 @@ -33,6 +34,7 @@ cat > $tempRules < $tempText echo "784" > $tempRef1 diff $tempRef1 $tempText @@ -54,17 +56,34 @@ diff $tempRef1 $tempText # -------------------------------------------------------- # Test 2 # -------------------------------------------------------- +bufrFile=amv2_87.bufr +cat > $tempRules <percentConfidence!0]"; +EOF +cat $tempRules + +export ECCODES_BUFR_MULTI_ELEMENT_CONSTANT_ARRAYS=1 +${tools_dir}/codes_bufr_filter $tempRules $bufrFile > $tempText 2>$tempErrs +grep -q '^48 54 59.*91 97' $tempText + + +# -------------------------------------------------------- +# Test 3 +# -------------------------------------------------------- bufrFile=asca_139.bufr cat > $tempRules </dev/null +echo "TODO: Searching for backscatter ... currently failing" export ECCODES_BUFR_MULTI_ELEMENT_CONSTANT_ARRAYS=1 -${tools_dir}/codes_bufr_filter $tempRules $bufrFile - +${tools_dir}/codes_bufr_filter $tempRules $bufrFile 2>$tempErrs +cat $tempErrs # Clean up -rm -rf $tempRules $tempText $tempRef1 $tempRef2 +rm -rf $tempRules $tempText $tempRef1 $tempRef2 $tempErrs