mirror of https://github.com/ecmwf/eccodes.git
ECC-1623: BUFR: Assigning a single-element array to a string key fails with FunctionNotImplementedError
This commit is contained in:
parent
7b240da8d5
commit
38bdecaf95
|
@ -322,7 +322,19 @@ static int pack_string_array(grib_accessor* a, const char** v, size_t* len)
|
|||
}
|
||||
}
|
||||
else {
|
||||
ret = GRIB_NOT_IMPLEMENTED;
|
||||
//ECC-1623
|
||||
if (*len != self->numberOfSubsets) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"Number of values mismatch for '%s': %zu strings provided but expected %ld (=number of subsets)",
|
||||
a->name, *len, self->numberOfSubsets);
|
||||
return GRIB_WRONG_ARRAY_SIZE;
|
||||
}
|
||||
for (i = 0; i < *len; i++) {
|
||||
//idx = (int)self->numericValues->v[self->subsetNumber]->v[self->index] / 1000 - 1;
|
||||
idx = (int)self->numericValues->v[i]->v[self->index] / 1000 - 1;
|
||||
self->stringValues->v[idx]->v[0] = strdup(v[i]);
|
||||
}
|
||||
*len=1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -122,6 +122,7 @@ if( HAVE_BUILD_TOOLS )
|
|||
bufr_ecc-1304
|
||||
bufr_ecc-1347
|
||||
bufr_ecc-1395
|
||||
bufr_ecc-1623
|
||||
bufr_json_samples
|
||||
bufr_ecc-359
|
||||
bufr_ecc-517
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh
|
||||
# (C) Copyright 2005- 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.ctest.sh
|
||||
|
||||
REDIRECT=/dev/null
|
||||
|
||||
label="bufr_ecc-1623_test"
|
||||
tempBufr=temp.$label.bufr
|
||||
tempFilt=temp.$label.filt
|
||||
tempText=temp.$label.txt
|
||||
tempRef=temp.$label.ref
|
||||
|
||||
sample_bufr4=$ECCODES_SAMPLES_PATH/BUFR4.tmpl
|
||||
|
||||
cat > $tempFilt <<EOF
|
||||
set numberOfSubsets = 2;
|
||||
set compressedData = 0;
|
||||
set unexpandedDescriptors = { 307011 };
|
||||
set icaoLocationIndicator = { "peach", "cedar" };
|
||||
set stationType = { 2, 1 };
|
||||
set pack = 1;
|
||||
write;
|
||||
EOF
|
||||
|
||||
${tools_dir}/codes_bufr_filter -o $tempBufr $tempFilt $sample_bufr4
|
||||
echo 'set unpack=1; print "[icaoLocationIndicator]";' |\
|
||||
${tools_dir}/codes_bufr_filter - $tempBufr > $tempText
|
||||
|
||||
cat > $tempRef<<EOF
|
||||
peach cedar
|
||||
EOF
|
||||
|
||||
diff $tempRef $tempText
|
||||
|
||||
rm -f $tempBufr $tempFilt $tempRef $tempText
|
Loading…
Reference in New Issue