diff --git a/src/grib_accessor_class_data_apply_boustrophedonic.c b/src/grib_accessor_class_data_apply_boustrophedonic.c index ccd2d28e7..1c4d47249 100644 --- a/src/grib_accessor_class_data_apply_boustrophedonic.c +++ b/src/grib_accessor_class_data_apply_boustrophedonic.c @@ -17,7 +17,7 @@ CLASS = accessor SUPER = grib_accessor_class_gen IMPLEMENTS = init - IMPLEMENTS = unpack_double;unpack_double_element + IMPLEMENTS = unpack_double;unpack_double_element;unpack_double_element_set IMPLEMENTS = pack_double IMPLEMENTS = value_count IMPLEMENTS = dump;get_native_type @@ -47,6 +47,7 @@ static void dump(grib_accessor*, grib_dumper*); static void init(grib_accessor*, const long, grib_arguments*); static void init_class(grib_accessor_class*); static int unpack_double_element(grib_accessor*, size_t i, double* val); +static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); typedef struct grib_accessor_data_apply_boustrophedonic { @@ -100,7 +101,7 @@ static grib_accessor_class _grib_accessor_class_data_apply_boustrophedonic = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ - 0, /* unpack a given set of elements */ + &unpack_double_element_set, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -135,7 +136,6 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; - c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -291,6 +291,13 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return GRIB_SUCCESS; } +static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +{ + Assert(!"unpack_double_element_set: apply boustrophedonic packing "); + return GRIB_DECODING_ERROR; +} + + static int pack_double(grib_accessor* a, const double* val, size_t* len) { grib_accessor_data_apply_boustrophedonic* self = (grib_accessor_data_apply_boustrophedonic*)a; diff --git a/src/grib_accessor_class_data_apply_boustrophedonic_bitmap.c b/src/grib_accessor_class_data_apply_boustrophedonic_bitmap.c index f91daf0cb..437e861a1 100644 --- a/src/grib_accessor_class_data_apply_boustrophedonic_bitmap.c +++ b/src/grib_accessor_class_data_apply_boustrophedonic_bitmap.c @@ -17,7 +17,7 @@ CLASS = accessor SUPER = grib_accessor_class_gen IMPLEMENTS = init - IMPLEMENTS = unpack_double;unpack_double_element + IMPLEMENTS = unpack_double;unpack_double_element;unpack_double_element_set IMPLEMENTS = pack_double IMPLEMENTS = value_count IMPLEMENTS = dump;get_native_type @@ -50,6 +50,7 @@ static void dump(grib_accessor*, grib_dumper*); static void init(grib_accessor*, const long, grib_arguments*); static void init_class(grib_accessor_class*); static int unpack_double_element(grib_accessor*, size_t i, double* val); +static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); typedef struct grib_accessor_data_apply_boustrophedonic_bitmap { @@ -105,7 +106,7 @@ static grib_accessor_class _grib_accessor_class_data_apply_boustrophedonic_bitma 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ - 0, /* unpack a given set of elements */ + &unpack_double_element_set, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -140,7 +141,6 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; - c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -343,6 +343,12 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return grib_get_double_element_internal(gh, self->coded_values, cidx, val); } +static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +{ + Assert(!"unpack_double_element_set: apply boustrophedonic bmp packing "); + return GRIB_DECODING_ERROR; +} + static int pack_double(grib_accessor* a, const double* val, size_t* len) { grib_accessor_data_apply_boustrophedonic_bitmap* self = (grib_accessor_data_apply_boustrophedonic_bitmap*)a; diff --git a/src/grib_accessor_class_data_raw_packing.c b/src/grib_accessor_class_data_raw_packing.c index a582cd0f1..813407a69 100644 --- a/src/grib_accessor_class_data_raw_packing.c +++ b/src/grib_accessor_class_data_raw_packing.c @@ -23,7 +23,7 @@ SUPER = grib_accessor_class_values IMPLEMENTS = init IMPLEMENTS = unpack_double - IMPLEMENTS = unpack_double_element + IMPLEMENTS = unpack_double_element;unpack_double_element_set IMPLEMENTS = pack_double IMPLEMENTS = value_count MEMBERS=const char* number_of_values @@ -48,6 +48,7 @@ static int value_count(grib_accessor*, long*); static void init(grib_accessor*, const long, grib_arguments*); static void init_class(grib_accessor_class*); static int unpack_double_element(grib_accessor*, size_t i, double* val); +static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); typedef struct grib_accessor_data_raw_packing { @@ -104,7 +105,7 @@ static grib_accessor_class _grib_accessor_class_data_raw_packing = { 0, /* next accessor */ 0, /* compare vs. another accessor */ &unpack_double_element, /* unpack only ith value */ - 0, /* unpack a given set of elements */ + &unpack_double_element_set, /* unpack a given set of elements */ 0, /* unpack a subarray */ 0, /* clear */ 0, /* clone accessor */ @@ -141,7 +142,6 @@ static void init_class(grib_accessor_class* c) c->nearest_smaller_value = (*(c->super))->nearest_smaller_value; c->next = (*(c->super))->next; c->compare = (*(c->super))->compare; - c->unpack_double_element_set = (*(c->super))->unpack_double_element_set; c->unpack_double_subarray = (*(c->super))->unpack_double_subarray; c->clear = (*(c->super))->clear; c->make_clone = (*(c->super))->make_clone; @@ -327,3 +327,9 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return ret; } + +static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +{ + Assert(!"unpack_double_element_set: raw packing "); + return GRIB_DECODING_ERROR; +} diff --git a/tests/grib_nearest_test.sh b/tests/grib_nearest_test.sh index 8b5641a65..3c571695e 100755 --- a/tests/grib_nearest_test.sh +++ b/tests/grib_nearest_test.sh @@ -82,5 +82,24 @@ grib_check_key_equals $temp earthIsOblate 1 ${tools_dir}/grib_ls -l 0,0 $temp +# IEEE regular lat/lon +# ---------------------------------------- +input_grb=${data_dir}/grid_ieee.grib +${tools_dir}/grib_get -F%.3g -l 70,345.2,1 $input_grb > $temp +grep -q "3.24e-08" $temp +${tools_dir}/grib_get -l 70,345.2,1 $input_grb > $temp +grep -q "Grid Point chosen #4 index=0 " $temp + +# CCDSDS regular lat/lon +# ---------------------------------------- +if [ $HAVE_AEC -eq 1 ]; then + input_grb=${data_dir}/ccsds.grib2 + ${tools_dir}/grib_get -l 79.0,203.0,1 $input_grb > $temp + grep -q "103484" $temp + ${tools_dir}/grib_ls -l 79.0,203.0,1 $input_grb > $temp + grep -q "Grid Point chosen #2 index=4163 " $temp +fi + + # Clean up rm -f $temp $tempRef