NOAA Weather Client Library
A comprehensive Rust client library for the NOAA Weather API. This crate provides type-safe access to weather forecasts, alerts, observations, radar data, and aviation weather products from the National Weather Service.
Features
- π‘οΈ Complete API Coverage - All NOAA Weather API endpoints
- π¨ Weather Alerts - Active alerts, warnings, and watches
- πΊοΈ Gridpoint Forecasts - Detailed forecasts with hourly data
- π‘ Radar Data - Real-time radar information
- βοΈ Aviation Weather - SIGMETs, AIRMETs, and Center Weather Advisories
- π’ NWS Offices - Office information and products
- π Point Data - Weather data for any coordinates
- π Async/Await - Built on
tokioandreqwest - π‘οΈ Type Safety - Comprehensive data models with serde
Quick Start
Add this to your Cargo.toml:
[]
= "0.1.0"
= { = "1.0", = ["full"] }
Basic Example
use Configuration;
use ;
async
Weather Alerts
use ;
let config = default;
// Get all active alerts
let active_alerts = get_active_alerts.await?;
// Get alerts for a specific area (state/territory)
let ca_alerts = get_active_alerts_for_area.await?;
// Get alerts for a specific zone
let zone_alerts = get_active_alerts_for_zone.await?;
Weather Observations
use ;
let config = default;
// Get latest observation for a station
let observation = get_latest_observation.await?;
println!;
// Get station metadata
let station = get_observation_station.await?;
println!;
Forecasts
use ;
let config = default;
// Get forecast for specific gridpoint
let forecast = get_gridpoint_forecast.await?;
// Get hourly forecast
let hourly = get_gridpoint_forecast_hourly.await?;
Configuration
The Configuration struct provides default settings that work out of the box:
use Configuration;
// Use default configuration
let config = default;
// Or customize the client
let config = Configuration ;
Error Handling
All API functions return Result<T, Error<E>> where E is the specific error type for that endpoint:
use ;
let config = default;
match get_point.await
API Coverage
This client covers all major NOAA Weather API endpoints:
| Module | Description | Key Functions |
|---|---|---|
alerts |
Weather alerts and warnings | get_active_alerts, get_alert |
points |
Point metadata and stations | get_point, get_point_stations |
gridpoints |
Detailed forecasts | get_gridpoint_forecast, get_gridpoint_forecast_hourly |
stations |
Weather stations | get_observation_station, get_latest_observation |
zones |
Forecast zones | get_zone, get_zone_forecast |
offices |
NWS offices | get_office, get_office_headlines |
radar |
Radar data | get_radar_stations, get_radar_servers |
aviation |
Aviation weather | get_sigmets, get_center_weather_advisories |
products |
Text products | get_product_types, get_products |
Authentication
The NOAA Weather API doesn't require authentication but NOAA recommends a unique User-Agent to identify your application.
From the NOAA Weather API Documentation:
A User Agent is required to identify your application. This string can be anything, and the more unique to your application the less likely it will be affected by a security event. If you include contact information (website or email), we can contact you if your string is associated to a security event. This will be replaced with an API key in the future.
User-Agent: (myweatherapp.com, contact@myweatherapp.com)
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Disclaimer
This project uses data published by NOAA/NWS but is otherwise unaffiliated with the National Weather Service and is not an official NWS library.