diff --git a/definitions/bufr/templates/BufrTemplate.def b/definitions/bufr/templates/BufrTemplate.def index cfe2699ed..dc4e242b1 100644 --- a/definitions/bufr/templates/BufrTemplate.def +++ b/definitions/bufr/templates/BufrTemplate.def @@ -62,5 +62,3 @@ "Siral" = { unexpandedDescriptors = 312071 ; } "IasiL1c" = { unexpandedDescriptors = 340007 ; } "SaralAltika" = { unexpandedDescriptors = 340011 ; } - - diff --git a/src/grib_accessor_class_concept.c b/src/grib_accessor_class_concept.c index ff1a9cbd4..9a814a506 100644 --- a/src/grib_accessor_class_concept.c +++ b/src/grib_accessor_class_concept.c @@ -140,6 +140,9 @@ static void init_class(grib_accessor_class* c) #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 */ /* 0 means input strings are equal and 1 means not equal */ 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); } +/* Return 1 (=True) or 0 (=False) */ static int concept_condition_expression_true(grib_handle* h, grib_concept_condition* c) { long lval; long lres = 0; - int ok = 0; + int ok = FALSE; /* Boolean */ int err = 0; 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 1 (=True) or 0 (=False) */ static int concept_condition_iarray_true(grib_handle* h, grib_concept_condition* c) { long* val; size_t size = 0, i; - int ret; + int ret; /* Boolean */ int err = 0; err = grib_get_size(h, c->name, &size); - if (err == 0 || size != grib_iarray_used_size(c->iarray)) - return 0; + if (err || size != grib_iarray_used_size(c->iarray)) + return FALSE; val = (long*)grib_context_malloc_clear(h->context, sizeof(long) * size); err = grib_get_long_array(h, c->name, val, &size); - if (err == 0) - return 0; + if (err) + return FALSE; - ret = 1; + ret = TRUE; for (i = 0; i < size; i++) { if (val[i] != c->iarray->v[i]) { - ret = 0; + ret = FALSE; break; } } @@ -235,6 +240,7 @@ static int concept_condition_iarray_true(grib_handle* h, grib_concept_condition* return ret; } +/* Return 1 (=True) or 0 (=False) */ static int concept_condition_true(grib_handle* h, grib_concept_condition* c) { if (c->expression == NULL) diff --git a/tests/bufr_filter_misc.sh b/tests/bufr_filter_misc.sh index a796852a1..01bb95f72 100755 --- a/tests/bufr_filter_misc.sh +++ b/tests/bufr_filter_misc.sh @@ -648,9 +648,11 @@ cat >$fRules <> $fLog 1>> $fLog +res=`${tools_dir}/bufr_get -p bufrTemplate $fOut` +[ "$res" = "synopLand" ] ${tools_dir}/bufr_compare $fOut $fRef #2>> $fLog 1>> $fLog -rm -f $fOut +rm -f $fOut fOut="airep.bufr.out" fRef="airep.bufr.out.ref" @@ -661,6 +663,8 @@ cat >$fRules <> $fLog 1>> $fLog +res=`${tools_dir}/bufr_get -p bufrTemplate $fOut` +[ "$res" = "aircraftReportWithSecondsAndPressure" ] ${tools_dir}/bufr_compare $fOut $fRef #2>> $fLog 1>> $fLog rm -f $fOut diff --git a/tests/bufr_templates.sh b/tests/bufr_templates.sh index 7d1498298..a43375b6b 100755 --- a/tests/bufr_templates.sh +++ b/tests/bufr_templates.sh @@ -20,7 +20,12 @@ templates_file="${ECCODES_DEFINITION_PATH}/bufr/templates/BufrTemplate.def" templates=`cat $templates_file | awk -F= '{print $1}' | tr -d '"'` for t in $templates; do ${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 rm -f $temp