Code Monkey home page Code Monkey logo

circuitpython_temperaturetools's Introduction

Introduction

Discord Build Status Code Style: Black

A collection of CircuitPython helpers for calculating Dew Point, Heat Index, and for converting temperature units..

Dew Point calculates dew point temperature from measured temperature (Celsius) and humidity (percent). Returns the calculated dew point (Celsius) and summary description. Detailed description is provided if verbose=True. Dew point value is constrained to the range of 0 to 40 (Celsius).

Heat Index calculates heat index temperature from measured temperature (Celsius) and humidity (percent). Returns the calculated heat index (Celsius) and summary description. Detailed description is provided if verbose=True.

Unit Converters convert values between Celsius, Fahrenheit, and Kelvin.

https://github.com/CedarGroveStudios/CircuitPython_AirQualityTools/blob/main/media/WARNING.jpg

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install cedargrove_temperaturetools

Or the following command to update an existing version:

circup update

Usage Example

from cedargrove_temperaturetools.dew_point import dew_point
from cedargrove_temperaturetools.heat_index import heat_index
from cedargrove_temperaturetools.unit_converters import (
    celsius_to_fahrenheit,
    celsius_to_kelvin,
)

# Measured temperature and humidity
TEMPERATURE = 24  # Degrees Celsius
HUMIDITY = 50  # Relative humidity in percent

dew_point_temp, description = dew_point(TEMPERATURE, HUMIDITY)
print(f"Dew Point = {dew_point_temp} {description}")

dew_point_temp, description = dew_point(TEMPERATURE, HUMIDITY, verbose=True)
print(f"Dew Point = {dew_point_temp} {description}")

heat_index_temp, description = heat_index(TEMPERATURE, HUMIDITY)
print(f"Heat Index = {heat_index_temp} {description}")

heat_index_temp, description = heat_index(TEMPERATURE, HUMIDITY, verbose=True)
print(f"Heat Index = {heat_index_temp} {description}")

print(f"Measured Temperature (Celsius) = {TEMPERATURE}")
print(f"Measured Temperature (Fahrenheit) = {celsius_to_fahrenheit(TEMPERATURE)}")
print(f"Measured Temperature (Kelvin) = {celsius_to_kelvin(TEMPERATURE)}")

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.