/ examples / cedargrove_temperaturetools_simpletest.py
cedargrove_temperaturetools_simpletest.py
 1  # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
 2  # SPDX-FileCopyrightText: Copyright (c) 2022 JG for Cedar Grove Maker Studios
 3  #
 4  # SPDX-License-Identifier: Unlicense
 5  
 6  from cedargrove_temperaturetools.dew_point import dew_point
 7  from cedargrove_temperaturetools.heat_index import heat_index
 8  from cedargrove_temperaturetools.unit_converters import (
 9      celsius_to_fahrenheit,
10      celsius_to_kelvin,
11  )
12  
13  # Measured temperature and humidity
14  TEMPERATURE = 24  # Degrees Celsius
15  HUMIDITY = 50  # Relative humidity in percent
16  
17  dew_point_temp, description = dew_point(TEMPERATURE, HUMIDITY)
18  print(f"Dew Point = {dew_point_temp} {description}")
19  
20  dew_point_temp, description = dew_point(TEMPERATURE, HUMIDITY, verbose=True)
21  print(f"Dew Point = {dew_point_temp} {description}")
22  
23  heat_index_temp, description = heat_index(TEMPERATURE, HUMIDITY)
24  print(f"Heat Index = {heat_index_temp} {description}")
25  
26  heat_index_temp, description = heat_index(TEMPERATURE, HUMIDITY, verbose=True)
27  print(f"Heat Index = {heat_index_temp} {description}")
28  
29  print(f"Measured Temperature (Celsius) = {TEMPERATURE}")
30  print(f"Measured Temperature (Fahrenheit) = {celsius_to_fahrenheit(TEMPERATURE)}")
31  print(f"Measured Temperature (Kelvin) = {celsius_to_kelvin(TEMPERATURE)}")