ECC-1330: BUFR: bufrTemplate='unknown' but should be 'aircraftReportWithSecondsAndPressure'

This commit is contained in:
Shahram Najm 2022-01-21 16:03:51 +00:00
parent 66a5a0a3a6
commit 9b2b7d69c7
4 changed files with 25 additions and 12 deletions

View File

@ -62,5 +62,3 @@
"Siral" = { unexpandedDescriptors = 312071 ; } "Siral" = { unexpandedDescriptors = 312071 ; }
"IasiL1c" = { unexpandedDescriptors = 340007 ; } "IasiL1c" = { unexpandedDescriptors = 340007 ; }
"SaralAltika" = { unexpandedDescriptors = 340011 ; } "SaralAltika" = { unexpandedDescriptors = 340011 ; }

View File

@ -140,6 +140,9 @@ static void init_class(grib_accessor_class* c)
#define MAX_CONCEPT_STRING_LENGTH 255 #define MAX_CONCEPT_STRING_LENGTH 255
#define FALSE 0
#define TRUE 1
/* Note: A fast cut-down version of strcmp which does NOT return -1 */ /* Note: A fast cut-down version of strcmp which does NOT return -1 */
/* 0 means input strings are equal and 1 means not equal */ /* 0 means input strings are equal and 1 means not equal */
GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b) GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
@ -163,11 +166,12 @@ static void dump(grib_accessor* a, grib_dumper* dumper)
grib_dump_string(dumper, a, NULL); grib_dump_string(dumper, a, NULL);
} }
/* Return 1 (=True) or 0 (=False) */
static int concept_condition_expression_true(grib_handle* h, grib_concept_condition* c) static int concept_condition_expression_true(grib_handle* h, grib_concept_condition* c)
{ {
long lval; long lval;
long lres = 0; long lres = 0;
int ok = 0; int ok = FALSE; /* Boolean */
int err = 0; int err = 0;
const int type = grib_expression_native_type(h, c->expression); const int type = grib_expression_native_type(h, c->expression);
@ -207,27 +211,28 @@ static int concept_condition_expression_true(grib_handle* h, grib_concept_condit
return ok; return ok;
} }
/* Return 1 (=True) or 0 (=False) */
static int concept_condition_iarray_true(grib_handle* h, grib_concept_condition* c) static int concept_condition_iarray_true(grib_handle* h, grib_concept_condition* c)
{ {
long* val; long* val;
size_t size = 0, i; size_t size = 0, i;
int ret; int ret; /* Boolean */
int err = 0; int err = 0;
err = grib_get_size(h, c->name, &size); err = grib_get_size(h, c->name, &size);
if (err == 0 || size != grib_iarray_used_size(c->iarray)) if (err || size != grib_iarray_used_size(c->iarray))
return 0; return FALSE;
val = (long*)grib_context_malloc_clear(h->context, sizeof(long) * size); val = (long*)grib_context_malloc_clear(h->context, sizeof(long) * size);
err = grib_get_long_array(h, c->name, val, &size); err = grib_get_long_array(h, c->name, val, &size);
if (err == 0) if (err)
return 0; return FALSE;
ret = 1; ret = TRUE;
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
if (val[i] != c->iarray->v[i]) { if (val[i] != c->iarray->v[i]) {
ret = 0; ret = FALSE;
break; break;
} }
} }
@ -235,6 +240,7 @@ static int concept_condition_iarray_true(grib_handle* h, grib_concept_condition*
return ret; return ret;
} }
/* Return 1 (=True) or 0 (=False) */
static int concept_condition_true(grib_handle* h, grib_concept_condition* c) static int concept_condition_true(grib_handle* h, grib_concept_condition* c)
{ {
if (c->expression == NULL) if (c->expression == NULL)

View File

@ -648,9 +648,11 @@ cat >$fRules <<EOF
EOF EOF
${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog ${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
res=`${tools_dir}/bufr_get -p bufrTemplate $fOut`
[ "$res" = "synopLand" ]
${tools_dir}/bufr_compare $fOut $fRef #2>> $fLog 1>> $fLog ${tools_dir}/bufr_compare $fOut $fRef #2>> $fLog 1>> $fLog
rm -f $fOut rm -f $fOut
fOut="airep.bufr.out" fOut="airep.bufr.out"
fRef="airep.bufr.out.ref" fRef="airep.bufr.out.ref"
@ -661,6 +663,8 @@ cat >$fRules <<EOF
EOF EOF
${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog ${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
res=`${tools_dir}/bufr_get -p bufrTemplate $fOut`
[ "$res" = "aircraftReportWithSecondsAndPressure" ]
${tools_dir}/bufr_compare $fOut $fRef #2>> $fLog 1>> $fLog ${tools_dir}/bufr_compare $fOut $fRef #2>> $fLog 1>> $fLog
rm -f $fOut rm -f $fOut

View File

@ -20,7 +20,12 @@ templates_file="${ECCODES_DEFINITION_PATH}/bufr/templates/BufrTemplate.def"
templates=`cat $templates_file | awk -F= '{print $1}' | tr -d '"'` templates=`cat $templates_file | awk -F= '{print $1}' | tr -d '"'`
for t in $templates; do for t in $templates; do
${tools_dir}/bufr_set -s bufrTemplate=$t $sample $temp ${tools_dir}/bufr_set -s bufrTemplate=$t $sample $temp
${tools_dir}/bufr_dump -p $temp > /dev/null # TODO: There is a matching issue with OmpsNadirProfile: mixed up with OmpsTotalColumn
if [ "$t" != "OmpsNadirProfile" ]; then
res=`${tools_dir}/bufr_get -p BufrTemplate $temp`
[ "$res" = "$t" ]
${tools_dir}/bufr_dump -p $temp > /dev/null
fi
done done
rm -f $temp rm -f $temp