show example output

main
_ 2025-01-15 01:56:07 +00:00
parent 81d35b92de
commit 598163fb27
1 changed files with 157 additions and 0 deletions

157
README.md
View File

@ -1,3 +1,160 @@
# weather_dot_gov_rs
Parses the DWML machine-readable format produced by forecast.weather.gov.
e.g. `cargo run --example reqwest 40.71 -74.01` yields:
```
Dwml {
head: Head {
product: Product {
creation_date: CreationDate {
refresh_frequency: "PT1H",
value: "2025-01-14T18:08:11-05:00",
},
},
source: Source {
production_center: "New York, NY",
},
},
data: (
Forecast {
location: Location {
area_description: None,
description: Some(
"New York, NY",
),
},
time_layout: (
TimeLayout {
time_coordinate: Local,
layout_key: K12Hourly,
start_valid_time: [
StartValidTime {
period_name: "Tonight",
value: "2025-01-14T20:00:00-05:00",
},
...
StartValidTime {
period_name: "Tuesday",
value: "2025-01-21T06:00:00-05:00",
},
],
},
TimeLayout {
time_coordinate: Local,
layout_key: K24Hourly1,
start_valid_time: [
StartValidTime {
period_name: "Tonight",
value: "2025-01-14T20:00:00-05:00",
},
...
StartValidTime {
period_name: "Monday Night",
value: "2025-01-20T18:00:00-05:00",
},
],
},
TimeLayout {
time_coordinate: Local,
layout_key: K24Hourly2,
start_valid_time: [
StartValidTime {
period_name: "Wednesday",
value: "2025-01-15T06:00:00-05:00",
},
...
StartValidTime {
period_name: "Tuesday",
value: "2025-01-21T06:00:00-05:00",
},
],
},
),
parameters: Parameters {
temperature: (
Temperature {
temp_type: Minimum,
units: Fahrenheit,
time_layout: K24Hourly1,
value: [
26,
24,
27,
34,
34,
24,
17,
],
},
Temperature {
temp_type: Maximum,
units: Fahrenheit,
time_layout: K24Hourly2,
value: [
33,
32,
39,
43,
39,
30,
24,
],
},
),
probability_of_precipitation: ProbabilityOfPrecipitation {
time_layout: K12Hourly,
value: [
PrecipitationValue {
value: None,
},
...
PrecipitationValue {
value: Some(
30,
),
},
PrecipitationValue {
value: None,
},
PrecipitationValue {
value: None,
},
],
},
weather: Weather {
time_layout: K12Hourly,
weather_conditions: [
WeatherCondition {
weather_summary: "Mostly Clear",
},
...
WeatherCondition {
weather_summary: "Mostly Sunny",
},
],
},
},
},
CurrentObservations {
location: Location {
area_description: Some(
"New York City, Central Park, NY",
),
description: None,
},
time_layout: TimeLayout {
time_coordinate: Local,
layout_key: K1Hour,
start_valid_time: [
StartValidTime {
period_name: "current",
value: "2025-01-14T19:51:00-05:00",
},
],
},
},
),
}
```