Expand description
Converting readings between real-world units.
Cheap environmental sensors report whatever unit their datasheet chose - a BME280 gives pressure in pascals, a thermocouple in degrees Celsius - while the person reading a dashboard thinks in another. These are the exact, named conversions for the units the cookbook uses most, so a conversion is a call with an obvious name rather than a magic constant copied into application code.
Functionsยง
- celsius_
to_ fahrenheit - Converts a temperature from degrees Celsius to degrees Fahrenheit.
- celsius_
to_ kelvin - Converts a temperature from degrees Celsius to kelvin.
- fahrenheit_
to_ celsius - Converts a temperature from degrees Fahrenheit to degrees Celsius.
- hectopascals_
to_ pascals - Converts a pressure from hectopascals (millibars) to pascals.
- kelvin_
to_ celsius - Converts a temperature from kelvin to degrees Celsius.
- kilopascals_
to_ pascals - Converts a pressure from kilopascals to pascals.
- pascals_
to_ hectopascals - Converts a pressure from pascals to hectopascals (millibars).
- pascals_
to_ kilopascals - Converts a pressure from pascals to kilopascals.
- pascals_
to_ psi - Converts a pressure from pascals to pounds per square inch.
- percent_
to_ ratio - Converts a percentage to a fraction in
0.0..=1.0. - psi_
to_ pascals - Converts a pressure from pounds per square inch to pascals.
- ratio_
to_ percent - Converts a fraction in
0.0..=1.0to a percentage.