#weather #meteorology


Meteorological formulas and constants

25 releases

0.9.0 Jun 13, 2021
0.8.2 May 31, 2021
0.7.6 Nov 30, 2020
0.7.4 Mar 5, 2020
0.2.2 Mar 8, 2018

#44 in Science

Download history 26/week @ 2021-02-25 7/week @ 2021-03-04 6/week @ 2021-03-11 40/week @ 2021-03-18 116/week @ 2021-03-25 25/week @ 2021-04-01 35/week @ 2021-04-08 55/week @ 2021-04-15 64/week @ 2021-04-22 46/week @ 2021-04-29 14/week @ 2021-05-06 26/week @ 2021-05-13 6/week @ 2021-05-20 21/week @ 2021-05-27 6/week @ 2021-06-03 73/week @ 2021-06-10

170 downloads per month
Used in less than 6 crates

Custom license

2.5K SLoC


Github Actions

Meteorological constants and formulas.

This library includes newtype types, or wrapper types, to help with using the proper units when doing calculations, some common meteorological constants, and some functions for basic calculations. It has thus far been developed to support libraries and an application used for displaying and analyzing skew-t data. So you will find the functions and variables are mostly things that would typically be used on a skew-t. Future versions may expand the intended use cases.

I investigated using some sort of dimensional analysis via types with a crate like uom or dimensioned instead of making my own newtype types. However after experimentation, I decided I did not want to make another crate part of the API since choosing to use one would force that library on the users of this library.

I've found the optional crate to be very useful when dealing with f64 types in situations where there may be missing values, so I included a feature use_optional that enables the newtypes in this crate to be used in the same manner as an f64 is with optional.


use metfor::{Kelvin, Celsius, HectoPascal, Millibar, potential_temperature};

let t1 = Kelvin(300.0);
let p1 = HectoPascal(1000.0);
let theta1 = potential_temperature(p1, t1);

let t2 = Celsius(0.0);
let p2 = Millibar(700.0);
let theta2 = potential_temperature(p2, t2);

println!("theta1 = {:?} and theta2 = {:?}", theta1, theta2);