Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
value = (intValue + ref) / (10^scale)
min = ref / 10^scale
max = (2^width - 2 + ref) / (10^scale)
intValue = (10^scale) * value - ref
precision = 10^-scale

Here Where scale=scale factor, ref=reference value (or bias) and width=bit width of the descriptor.
And "intValue" is an integer of N "width" bits from the Data Section (N=bit width of descriptor).

Example:
For "pressure" we have:
code=007004,  type=long (integer), scale=-1, reference=0, bitwidth=14

...

intValue = value*10scale - ref

intValue = value*10-1 - 0 = round(213.61/10) = 21
So we store the integer 21 in the BUFR message using 14 bits.
When we come to decode it, we use the first formula i.e. value = (21 + 0) * 10^-/ 10-1 = 21 * 10 = 210
So when you put in 213.61, you will get out 210. Precision The precision of this element is 10^10-scale i.e. 10 so it will not store intermediate values. It will be 210 or 220 or 230 etc..

...

Operator 207YYY means "Increase scale, reference value and data width"
Description: For Table B elements that are not CCITT IA5 (character data), code or flag tables:
1. Add YYY bits to the existing scale factor
2. Multiply the existing reference value by 10**YYY
3. Calculate ((10 * YYY) + 2) / 3, disregard any fractional remainder and add the result to the existing bit width."

That way Now we can encode pressure with 2 decimal digits:

"key" : "pressure",
"value" : 12.34,
"index" : 1,
"code" : "007004",
"units" : "Pa",
"scale" : 2,
"reference" : 0,
"width" : 24

Note the difference with the original 007004 descriptor:

"key" : "pressure",
"value" : 10,
"index" : 1,
"code" : "007004",
"units" : "Pa",
"scale" : -1,
"reference" : 0,
"width" : 14

so we increased the width by 10 bits and changed the scale to 2.

...

Content by Label
showLabelsfalse
max5
spacesUDOC
showSpacefalse
sortmodified
reversetrue
typepage
excludeCurrenttrue
cqllabel in ("bufr","eccbufr-faqs") and type = "page" and space = "UDOC"
labelsbufr eccbufr-faqs

...