...
| Key | Behaviour |
|---|---|
decimalPrecision | Does not trigger repacking. If it's set, the precision will be applied the next time the values are written. |
setDecimalPrecision | When set, it reads the existing data values and repacks them with new encoding parameters. |
changeDecimalPrecision | An alias forchangeDecimalPrecisionfor |
How is decimal precision used to calculate bitsPerValue?
...
| Code Block |
|---|
double values[] = {10.223, 11.244, 9.3708, 8223.1};
size_t values_size = 4;
long decimalPrecision = 2;
codes_set_long(h, "decimalPrecision", decimalPrecision);
codes_set_values(h, "values", values, values_size);
/* bitsPerValue is now automatically calculated */
// long bitsPerValue;
// codes_get_long(h, "bitsPerValue", &bitsPerValue);
|
...
| Code Block |
|---|
long decimalPrecision = 2; codes_set_long(h, "setDecimalPrecision", decimalPrecision); /* bitsPerValue is now automatically recalculated */ // long bitsPerValue; // codes_get_long(h, "bitsPerValue", &bitsPerValue); |
...
| Code Block | ||
|---|---|---|
| ||
# Set 4 data values and pack with 2 decimal digits of precision
set Ni = 2;
set Nj = 2;
set decimalPrecision = 3;
set values = { 2.7047, 2.8053, 2.9012, 3.1109 };
print "[bitsPerValue=]";
write "out_set_values.grib"; |
...