mod calculations;
mod constants;
pub mod conversions;
use crate::constants::constants::{
HUMIDEX_CONSTANT_OFFSET, LATENT_HEAT_OF_VAPORIZATION, SATURATION_VAPOR_PRESSURE_REFERENCE,
STANDARD_CONDENSATION_POINT,
};
pub use self::calculations::dew_point::celsius_dew_point;
pub use self::calculations::dew_point::common_celsius_dew_point;
pub use self::calculations::dew_point::common_fahrenheit_dew_point;
pub use self::calculations::dew_point::fahrenheit_dew_point;
pub use self::calculations::heat_index::celsius_heat_index;
pub use self::calculations::heat_index::fahrenheit_heat_index;
pub use self::calculations::humidex::celsius_humidex;
pub use self::calculations::humidex::common_celsius_humidex;
pub use self::calculations::humidex::common_fahrenheit_humidex;
pub use self::calculations::humidex::fahrenheit_humidex;
pub use self::calculations::mixing_ratio::celsius_mixing_ratio;
pub use self::calculations::mixing_ratio::common_celsius_mixing_ratio;
pub use self::calculations::mixing_ratio::common_fahrenheit_mixing_ratio;
pub use self::calculations::mixing_ratio::fahrenheit_mixing_ratio;
pub use self::calculations::absolute_humidity::celsius_absolute_humidity;
pub use self::calculations::absolute_humidity::fahrenheit_absolute_humidity;
pub use self::conversions::temperature::celsius_to_fahrenheit;
pub use self::conversions::temperature::celsius_to_kelvin;
pub use self::conversions::temperature::fahrenheit_to_celsius;
pub use self::conversions::temperature::fahrenheit_to_kelvin;
pub use self::conversions::temperature::kelvin_to_celsius;
pub use self::conversions::temperature::kelvin_to_fahrenheit;
pub use self::conversions::pressure::hpa_to_inhg;
pub use self::conversions::pressure::hpa_to_mmhg;
pub use self::conversions::pressure::inhg_to_hpa;
pub use self::conversions::pressure::mmhg_to_hpa;
pub use self::conversions::wind_speed::kmph_to_knots;
pub use self::conversions::wind_speed::kmph_to_mph;
pub use self::conversions::wind_speed::kmph_to_mps;
pub use self::conversions::wind_speed::knots_to_kmph;
pub use self::conversions::wind_speed::knots_to_mph;
pub use self::conversions::wind_speed::knots_to_mps;
pub use self::conversions::wind_speed::mph_to_kmph;
pub use self::conversions::wind_speed::mph_to_knots;
pub use self::conversions::wind_speed::mph_to_mps;
pub use self::conversions::wind_speed::mps_to_kmph;
pub use self::conversions::wind_speed::mps_to_knots;
pub use self::conversions::wind_speed::mps_to_mph;
fn meteo_round(number: &f64) -> f64 {
(number * 10000.0).round() / 10000.0
}
fn saturation_vapor_pressure(temperature_celsius: &f64) -> f64 {
let saturation_vapor_pressure = SATURATION_VAPOR_PRESSURE_REFERENCE
* HUMIDEX_CONSTANT_OFFSET.powf(
(LATENT_HEAT_OF_VAPORIZATION * temperature_celsius)
/ (STANDARD_CONDENSATION_POINT + temperature_celsius),
);
saturation_vapor_pressure
}