https://github.com/psibi/weather_noaa
Rust parser for NOAA weather data
https://github.com/psibi/weather_noaa
rust weather weather-api
Last synced: about 1 year ago
JSON representation
Rust parser for NOAA weather data
- Host: GitHub
- URL: https://github.com/psibi/weather_noaa
- Owner: psibi
- Created: 2021-03-28T14:49:37.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-31T12:57:45.000Z (over 2 years ago)
- Last Synced: 2025-03-18T15:54:16.968Z (about 1 year ago)
- Topics: rust, weather, weather-api
- Language: Rust
- Homepage:
- Size: 103 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# weathernoaa
[](https://github.com/psibi/weather_noaa/actions)
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](https://www.weather.gov/arh/stationlist). In
general, figuring out station IDs is harder. These are the various
resources I usually use (if you find any source, please send a PR):
- [Archive.org's NOAA reference list showing identification numbers and information for each station in the Federal Climate Complex ISD](https://web.archive.org/web/20170119213347/ftp://ftp.ncdc.noaa.gov/pub/data/noaa/isd-history.txt)
- [Station list](https://www.ncei.noaa.gov/pub/data/noaa/isd-history.txt)
- [METAR Observation Station Identifiers](https://www.cnrfc.noaa.gov/metar.php)
- [India METAR Station ID](https://amssdelhi.gov.in/Palam1.php)
You can find all the [supported station id](https://tgftp.nws.noaa.gov/data/observations/metar/stations/) here. Alternatively,
you can also use the executable in the repository to confirm that it
works:
``` shellsession
❯ cargo run --bin noaa info --station-id VOBL
Finished dev [unoptimized + debuginfo] target(s) in 0.05s
Running `target/debug/noaa info --station-id VOBL`
WeatherInfo {
station: None,
weather_time: WeatherTime {
year: 2023,
month: 12,
day: 30,
time: "1330 UTC",
},
wind: WindInfo {
cardinal: "E",
azimuth: "080",
mph: "9",
knots: "8",
},
visibility: "greater than 7 mile(s):0",
sky_condition: "mostly clear",
weather: None,
temperature: Temperature {
celsius: 23,
fahrenheit: 73,
},
dewpoint: Temperature {
celsius: 14,
fahrenheit: 57,
},
relative_humidity: "56%",
pressure: 1017,
}
```
## API Usage
``` rust
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:
``` rust
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,
};
```