diff --git a/src/grib_dumper_class_default.cc b/src/grib_dumper_class_default.cc index 7a7442959..5e093186b 100644 --- a/src/grib_dumper_class_default.cc +++ b/src/grib_dumper_class_default.cc @@ -219,6 +219,9 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) int err = 0; int isDouble = 0; + if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) + return; + switch (a->get_native_type()) { case GRIB_TYPE_LONG: a->unpack_long(&lvalue, &size); @@ -231,9 +234,6 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) break; } - if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) - return; - print_offset(self->dumper.out, d, a); if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) { diff --git a/tests/grib_dump_samples.sh b/tests/grib_dump_samples.sh index ba4f7d870..740750ba2 100755 --- a/tests/grib_dump_samples.sh +++ b/tests/grib_dump_samples.sh @@ -61,5 +61,10 @@ for s in $g2_samples; do grib_check_key_equals $sf "edition,packingType" "2 grid_ccsds" done +# Test dump_bits +sample_polar="$ECCODES_SAMPLES_PATH/polar_stereographic_pl_grib2.tmpl" +${tools_dir}/grib_dump $sample_polar > $temp +grep -q "resolutionAndComponentFlags" $temp +# Clean up rm -f $temp