#celsius #conversion #units #unit-conversion #weather #meteo

meteo_tools

A crate for counting and converting meteorological units

1 stable release

1.1.0 Feb 26, 2024
1.0.0 Feb 22, 2024
0.1.0 Feb 21, 2024

#268 in Science

Download history 244/week @ 2024-02-17 252/week @ 2024-02-24 18/week @ 2024-03-02 17/week @ 2024-03-09 4/week @ 2024-03-16 45/week @ 2024-03-30 9/week @ 2024-04-06

61 downloads per month

Custom license

32KB
337 lines

meteo_tools

A crate for counting and converting meteorological units. Accepts temperature in C or F, relative humidity and optionally atmospheric pressure, converting wind speeds and calculating heat points, humidex, heat index, etc.

Features

Calculations

  • Dew point
  • Heat index
  • Humidex
  • Mixing ratio
  • Absolute humidity

Conversions

  • Between Celsius, Fahrenheit and Kelvin
  • Between hPa to mmHg and inHg
  • Wind speed km/h, m/s, knots

Conversions are interchangeably, aka from Celsius to Fahrenheit and vice versa.

More will be coming soon. See the documentation.

Using meteorological algorithms as Magnus-Tetens formula, Clausius-Clapeyron equation and Rothfusz regression equation with standard constants. When working with atmospheric pressure (humidex etc.) are available functions whether you have atmospheric pressure measurements or uses constants.

Note that this is common purpose crate. I round values to 4 decimal places, I think it is enough precision for common use. I am trying to implement a variety of algorithms. Also, this crate is maybe not suitable for exact laboratory measurements, because values of constants for algorithms differ by different sources, you may need another constant for your application.

Also, I use resolution prefix common_ on algorithms using common constants (ex: dew point using constants instead of exact pressure) to be useful when you do not have atmospheric pressure measurements. Functions without common_ needs exact measurements.

I created this crate for my API to personal meteo project to count values from measured data sent from Raspberry PIs and Arduinos.# meteo_tools

Example of usage

It is simple and fun, let's enjoy :).

use meteo_tools::common_celsius_dew_point;

fn main() {
    let temperature = 22.5;
    let relative_humidity = 62.4;
    
    // returns dew point in f64
    let dew_point = common_celsius_dew_point(&temperature, &humidity);
}

Or converting degrees units.

use meteo_tools::celsius_to_fahrenheit;

fn main() {
    let celsius_temperature = 22.5;
    
    // Converts units to another scale
    let fahrenheit_temperature = celsius_to_fahrenheit(&celsius_temperature);
}

No runtime deps