Skip to content

Commit

Permalink
ECC-1958: Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Nov 13, 2024
1 parent e88b544 commit 341e170
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/accessor/grib_accessor_class_expanded_descriptors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ void grib_accessor_expanded_descriptors_t::__expand(bufr_descriptors_array* unex
Assert( uidx->type == BUFR_DESCRIPTOR_TYPE_REPLICATION );
Assert( uidx->F == 1 );
Assert( uidx->Y == 0 );
uidx->X = (int)(size - 1); // ECC-1958: X here is not limited to 6bits!
// ECC-1958 and ECC-1054:
// Here size can exceed 63 (num bits in X is 6)
// We need to set X but not the descriptor code
uidx->X = (int)(size - 1);
if (size < 64)
uidx->code = (size - 1) * 1000 + 100000;
//grib_bufr_descriptor_set_code(uidx, (size - 1) * 1000 + 100000);
size++;
}
Expand Down
21 changes: 18 additions & 3 deletions tests/bufr_ecc-1958.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ tempRef=temp.$label.ref

sample_bufr4=$ECCODES_SAMPLES_PATH/BUFR4.tmpl

#...
#infile=${data_dir}/SOME_FILE
# 005074 indexInRangeDirection
# 005075 indexInAzimuthalDirection
# 008085 beamIdentifier
# 022161 waveSpectra
# 002134 antennaBeamAzimuth

cat >$tempFilt<<EOF
set numberOfSubsets = 1;
set inputExtendedDelayedDescriptorReplicationFactor = {32};
Expand All @@ -34,8 +38,19 @@ cat >$tempFilt<<EOF
EOF
${tools_dir}/codes_bufr_filter -o $tempBufr $tempFilt $sample_bufr4

${tools_dir}/bufr_dump -p $tempBufr | wc -l
${tools_dir}/bufr_dump -p $tempBufr > $tempOut

c=$( grep -c -w indexInRangeDirection $tempOut )
[ $c -eq 32 ]

# 32*24 = 768
c=$( grep -c -w indexInAzimuthalDirection $tempOut )
[ $c -eq 768 ]

# 32*24*3 = 2304
c=$( grep -c -w antennaBeamAzimuth $tempOut )
[ $c -eq 2304 ]


# Clean up
rm -f $tempBufr $tempFilt $tempLog $tempOut $tempRef

0 comments on commit 341e170

Please sign in to comment.