Merge branch 'feature/ECC-1179-bufrcopy' into develop

This commit is contained in:
Shahram Najm 2020-12-14 10:53:23 +00:00
commit 3a420404a0
2 changed files with 33 additions and 11 deletions

View File

@ -10,19 +10,14 @@
. ./include.sh
# Enter data dir
cd ${data_dir}/bufr
# Define a common label for all the tmp files
label="bufr_copy_test"
# Create log file
fLog=${label}".log"
rm -f $fLog
touch $fLog
# Define tmp bufr files
fBufrInput=${label}".bufr.input"
fBufrTmp=${label}".bufr.tmp"
@ -30,7 +25,7 @@ fBufrTmp=${label}".bufr.tmp"
cat syno_multi.bufr temp_101.bufr > $fBufrInput
#----------------------------------------------------
# Test: copy synop messages
echo "Test: copy synop messages ..."
#----------------------------------------------------
rm -f $fBufrTmp
@ -43,7 +38,7 @@ for i in 1 2 3 ;do
done
#----------------------------------------------------
# Test: copy non-synop messages
echo "Test: copy non-synop messages ..."
#----------------------------------------------------
rm -f $fBufrTmp
@ -53,7 +48,7 @@ ${tools_dir}/bufr_copy -w dataCategory!=0 $fBufrInput $fBufrTmp >> $fLog
[ `${tools_dir}/bufr_get -p dataCategory:l $fBufrTmp` = "2" ]
#-------------------------------------------------------------------
# Test: use the square brackets to insert the value of a key
echo "Test: use the square brackets to insert the value of a key ..."
#-------------------------------------------------------------------
rm -f ${fBufrTmp}
rm -f ${fBufrTmp}_*.bufr
@ -68,7 +63,7 @@ rm -f ${fBufrTmp}_*.bufr
rm -f $fBufrInput
#-------------------------------------------------------------------
# Test: The -X option
echo "Test: The -X option ..."
#-------------------------------------------------------------------
echo "Test: use of -X option" >> $fLog
fBufrInput=aeolus_wmo_26.bufr
@ -86,7 +81,23 @@ r2=`${tools_dir}/bufr_get -n ls $fBufrTmp`
#r=`${tools_dir}/bufr_get -p typicalTime,numberOfSubsets $fBufrTmp`
#[ "$r" = "000013 41" ]
#-------------------------------------------------------------------
echo "Test: The -w option with unpack ..."
#-------------------------------------------------------------------
fBufrInput=tropical_cyclone.bufr
rm -f $fBufrTmp
${tools_dir}/bufr_copy -s unpack=1 -w stormIdentifier=70E $fBufrInput $fBufrTmp
num_msgs=`${tools_dir}/bufr_count $fBufrTmp`
[ $num_msgs -eq 1 ]
storm=`${tools_dir}/bufr_get -s unpack=1 -p stormIdentifier $fBufrTmp`
[ "$storm" = "70E" ]
rm -f $fBufrTmp
${tools_dir}/bufr_copy -s unpack=1 -w stormIdentifier=none $fBufrInput $fBufrTmp
[ ! -f "$fBufrTmp" ]
# Clean up
#-----------
rm -f $fLog
rm -f $fBufrTmp
rm -f $fLog $fBufrTmp

View File

@ -830,6 +830,17 @@ void grib_skip_check(grib_runtime_options* options, grib_handle* h)
{
int i, ret = 0;
grib_values* v = NULL;
/* ECC-1179: bufr_copy/bufr_ls: Allow 'where' clause with Data Section keys */
if (options->constraints_count > 0 && h->product_kind == PRODUCT_BUFR) {
for (i = 0; i < options->set_values_count; i++) {
if (strcmp(options->set_values[i].name, "unpack")==0) {
grib_set_long(h, "unpack", 1);
break;
}
}
}
for (i = 0; i < options->constraints_count; i++) {
v = &(options->constraints[i]);
if (v->equal) {