mirror of https://github.com/ecmwf/eccodes.git
ECC-1858: Allow user to control encoding via optimizeScaleFactor (by default 0)
This commit is contained in:
parent
cbb4389334
commit
f50d2c5884
|
@ -786,7 +786,7 @@ int grib_accessor_class_data_g22order_packing_t::pack_double(grib_accessor* a, c
|
||||||
// long nvals_per_group = 0;
|
// long nvals_per_group = 0;
|
||||||
// long nbits_per_group_val = 0;
|
// long nbits_per_group_val = 0;
|
||||||
|
|
||||||
long binary_scale_factor, decimal_scale_factor, typeOfOriginalFieldValues;
|
long binary_scale_factor, decimal_scale_factor, typeOfOriginalFieldValues, optimize_scale_factor;
|
||||||
// long groupSplittingMethodUsed, numberOfGroupsOfDataValues, referenceForGroupWidths;
|
// long groupSplittingMethodUsed, numberOfGroupsOfDataValues, referenceForGroupWidths;
|
||||||
long missingValueManagementUsed, primaryMissingValueSubstitute, secondaryMissingValueSubstitute;
|
long missingValueManagementUsed, primaryMissingValueSubstitute, secondaryMissingValueSubstitute;
|
||||||
long numberOfBitsUsedForTheGroupWidths, numberOfBitsUsedForTheScaledGroupLengths, orderOfSpatialDifferencing;
|
long numberOfBitsUsedForTheGroupWidths, numberOfBitsUsedForTheScaledGroupLengths, orderOfSpatialDifferencing;
|
||||||
|
@ -815,7 +815,10 @@ int grib_accessor_class_data_g22order_packing_t::pack_double(grib_accessor* a, c
|
||||||
if ((err = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS)
|
if ((err = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
int use_scale = 1;
|
if ((err = grib_get_long_internal(gh, self->optimize_scale_factor, &optimize_scale_factor)) != GRIB_SUCCESS)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
int use_scale = !optimize_scale_factor;
|
||||||
|
|
||||||
if ((err = grib_get_long_internal(gh, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS)
|
if ((err = grib_get_long_internal(gh, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -127,6 +127,8 @@ ${tools_dir}/grib_copy -r $infile $temp2
|
||||||
${tools_dir}/grib_compare -R all=0.3 -c data:n $infile $temp2
|
${tools_dir}/grib_compare -R all=0.3 -c data:n $infile $temp2
|
||||||
grib_check_key_equals $temp2 bitsPerValue 9 # Note: The input file has bpv=9
|
grib_check_key_equals $temp2 bitsPerValue 9 # Note: The input file has bpv=9
|
||||||
|
|
||||||
|
${tools_dir}/grib_set -rs optimizeScaleFactor=1 $infile $temp2
|
||||||
|
${tools_dir}/grib_compare $infile $temp2
|
||||||
|
|
||||||
# Simple to grid_complex
|
# Simple to grid_complex
|
||||||
tempComplex=temp.grib_bitmap.complex.grib
|
tempComplex=temp.grib_bitmap.complex.grib
|
||||||
|
|
Loading…
Reference in New Issue