Crates.io | weathernoaa |
lib.rs | weathernoaa |
version | 0.2.0 |
source | src |
created_at | 2021-05-16 14:24:34.303303 |
updated_at | 2021-05-21 19:05:32.204618 |
description | API wrapper over NOAA's observatory data to find weather information |
homepage | |
repository | https://github.com/psibi/weather_noaa |
max_upload_size | |
id | 398195 |
size | 51,742 |
API wrapper over NOAA's observatory data to find weather information. For finding the weather information, you need to know the name of the station code which can be obtained from here.
use anyhow::Result;
use weathernoaa::weather::*;
#[tokio::main]
async fn main() -> Result<()> {
let result = get_weather("VOBL".into()).await?;
println!("{:?}", result);
Ok(())
}
Running it will give this:
WeatherInfo {
station: None,
weather_time:
WeatherTime {
year: 2021,
month: 5,
day: 16,
time: "1200 UTC",
},
wind:
WindInfo {
cardinal: "SSW",
azimuth: "210",
mph: "10",
knots: "9",
},
visibility: "4 mile(s):0",
sky_condition: "partly cloudy",
weather: Some("light drizzle"),
temperature: Temperature {
celsius: 26,
fahrenheit: 78,
},
dewpoint: Temperature {
celsius: 19,
fahrenheit: 66,
},
relative_humidity: "65%",
pressure: 1010,
};