ECC-1560: GRIB2: Changing from PDTN=8 to 11 changes the level from 1.5 to 2

This commit is contained in:
Shahram Najm 2023-03-28 18:12:54 +01:00
parent 179a1ad2e0
commit 5d767639f2
2 changed files with 14 additions and 1 deletions

View File

@ -258,6 +258,13 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
long type_first = 0;
char pressure_units[10] = {0,};
size_t pressure_units_len = 10;
long lval = (long)value_first;
//printf("pack_double:: received %g\n", *val);
if (value_first == lval) {
//printf(" .... use pack_long for %g\n", value_first);
return pack_long(a, &lval, len);
}
if (*len != 1)
return GRIB_WRONG_ARRAY_SIZE;

View File

@ -162,7 +162,13 @@ int grib_init_accessor_from_handle(grib_loader* loader, grib_accessor* ga, grib_
pack_missing = 1;
}
switch (grib_accessor_get_native_type(ga)) {
long ga_type = grib_accessor_get_native_type(ga);
if (STR_EQUAL(name,"level")) {
//printf("..... loader_from_file: switch type to DOUBLE\n");
ga_type = GRIB_TYPE_DOUBLE;
}
switch (ga_type) {
case GRIB_TYPE_STRING:
/*ecc__grib_get_string_length(ga,&len); See ECC-490 */