mirror of https://github.com/ecmwf/eccodes.git
ECC-656: bufr_compare: using relative comparison (-R) with 'all' does not work
This commit is contained in:
parent
00a6a4b9dd
commit
42c724a4e9
|
@ -153,6 +153,14 @@ status=$?
|
|||
set -e
|
||||
[ $status -eq 1 ]
|
||||
|
||||
#----------------------------------------------------
|
||||
# ECC-656: using relative comparison (-R) with 'all'
|
||||
#----------------------------------------------------
|
||||
f='airc_142.bufr'
|
||||
echo 'set unpack=1;set airTemperature=228; set height=1.037e+04; set pack=1; write;' |\
|
||||
${tools_dir}/codes_bufr_filter -o $fBufrTmp - $f
|
||||
${tools_dir}/bufr_compare -R airTemperature=0.004,height=0.001 $f $fBufrTmp
|
||||
${tools_dir}/bufr_compare -R all=0.004 $f $fBufrTmp
|
||||
|
||||
# Clean up
|
||||
# -------------
|
||||
|
|
|
@ -893,12 +893,22 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
|
|||
}
|
||||
|
||||
if (!compareAbsolute) {
|
||||
int all_specified = 0; /* =1 if relative comparison with "all" specified */
|
||||
for (i=0;i<options->tolerance_count;i++) {
|
||||
if (!strcmp((options->tolerance[i]).name,name)) {
|
||||
if (!strcmp((options->tolerance[i]).name, "all")) {
|
||||
all_specified = 1;
|
||||
value_tolerance=(options->tolerance[i]).double_value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!all_specified) {
|
||||
for (i=0;i<options->tolerance_count;i++) {
|
||||
if ( strcmp( (options->tolerance[i]).name,name)==0 ) {
|
||||
value_tolerance=(options->tolerance[i]).double_value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((err1 = grib_get_double_array(handle1,name,dval1,&len1)) != GRIB_SUCCESS)
|
||||
|
|
|
@ -93,9 +93,9 @@ grib_options_help grib_options_help_list[] ={
|
|||
{"P:","key[:{s|d|i}],key[:{s|d|i}],...",
|
||||
"\n\t\tAs -p adding the declared keys to the default list.\n"},
|
||||
{"R:","key1=relative_error1,key2=relative_error2,...\n",
|
||||
"\tCompare floating point values using the relative error as tolerance."
|
||||
"\n\t\tkey1=relative_error will compare key1 using relative_error1."
|
||||
"\n\t\tall=relative_error will compare all the floating point keys using relative_error. Default all=0.\n"},
|
||||
"\tCompare floating point values using the relative error as tolerance."
|
||||
"\n\t\tkey1=relative_error1 will compare key1 using relative_error1."
|
||||
"\n\t\tall=relative_error will compare all the floating point keys using relative_error. Default all=0.\n"},
|
||||
{"S",0,"Strict. Only messages matching all the constraints are copied to"
|
||||
"\n\t\tthe output file\n"},
|
||||
{"T:","T | B | M | A","Message type. T->GTS, B->BUFR, M->METAR (Experimental),A->Any (Experimental).\n\t\t\tThe input file is interpreted according to the message type.\n"},
|
||||
|
|
Loading…
Reference in New Issue