ECC-1407: grib_set -r -s packingType=grid_simple does not preserve accuracy on input packingType=grid_ieee (Part 1)

This commit is contained in:
Shahram Najm 2022-06-24 12:10:24 +01:00
parent 43bce2bc38
commit fd31febaee
2 changed files with 11 additions and 1 deletions

View File

@ -430,6 +430,16 @@ int grib_set_string(grib_handle* h, const char* name, const char* val, size_t* l
return 0;
}
}
if ( !grib_inline_strcmp(name, "packingType") &&
(strcmp(val, "grid_simple")==0 || strcmp(val, "grid_ccsds")==0) ) {
char input_packing_type[100] = {0,};
size_t len = sizeof(input_packing_type);
grib_get_string(h, "packingType", input_packing_type, &len);
if (strcmp(input_packing_type, "grid_ieee") == 0) {
ret = grib_set_long(h, "bitsPerValue", 32); // TODO
if (ret) return ret;
}
}
a = grib_find_accessor(h, name);

View File

@ -80,7 +80,7 @@ input=${data_dir}/grid_ieee.grib
${tools_dir}/grib_set -r -s packingType=grid_simple $input $temp
grib_check_key_equals $input accuracy 32
grib_check_key_equals $temp packingType 'grid_simple'
grib_check_key_equals $temp accuracy 24
grib_check_key_equals $temp accuracy,bitsPerValue '32 32'
stats1=`${tools_dir}/grib_get -F%.2f -p skew,kurt $input`
stats2=`${tools_dir}/grib_get -F%.2f -p skew,kurt $temp`
[ "$stats1" = "$stats2" ]