# Code Table for Unit mappings A Code Table for Unit mappings provides a mapping of input units to output units for quantitative data. The unit conversion process consists of the following steps: - Read source unit. - Read target unit. - Convert source unit to target unit. Conversion between units is defined as follows: `Target unit = source unit * conversion factor + offset` Except when converting between temperature units, offset equals 0 in most cases. ``` An example of Celsius to Kelvin conversion: 1. Given 37 Celsius 2. Expect Kelvin 3. 37 * 1 + 273.15 = 310.15 K ``` ``` An example of Celsius to Fahrenheit conversion: 1. Given 37 Celsius 2. Expect Fahrenheit 3. 37 * 1.8 + 32 = 98.6 F ``` A Code Table for Unit mappings MUST include the following attribute: - entries The “entries” attribute is a map of key-value pairs, where the key denotes the conversion from source to target (e.g., "m->mm" or "deg_c->deg_f") and the value contains the conversion factor and the offset. All units and unit prefixes follow the “Data Protocols Lightweight Standards and Patterns for Data” [BER2013] proposal for describing units associated with numeric quantities. ```json= { "entries":{ "m->mm":{ "cf":1000 }, "m->yd":{ "cf":1.0936133 }, "deg_c->deg_f":{ "cf":1.8, "o":32 } } } ``` Example 23. Code snippet for a Code Table for Unit mappings. Code Table for Unit mappings is in denormalised form, meaning that the conversion between units and unit prefixes is pre-defined for all standard unit conversions for maximum efficiency.