3 个不稳定版本
0.2.1 | 2022 年 8 月 24 日 |
---|---|
0.2.0 | 2022 年 2 月 22 日 |
0.1.0 | 2022 年 2 月 4 日 |
#446 在 科学
34KB
542 行
nwws-oi
NOAA 天气电报服务开放接口的 Rust 客户端。
NWWS-OI 是国家气象服务通过其中分发文本产品的好几个平台之一。NWS 运行两个 XMPP 服务器,这些服务器实时将 文本产品 推送到客户端,这些产品在发布时立即发送。
特性
#![禁止(不安全代码)]
- 纯 Rust
- 异步(使用 Tokio)
示例
let mut stream = nwws_oi::Stream::new((username, password));
while let Some(event) = stream.next().await {
match event {
StreamEvent::ConnectionState(state) => {}
StreamEvent::Error(error) => {},
StreamEvent::Message(message) => {},
}
}
快速入门
- 注册
- 通过电子邮件从 NWS 接收凭据
$ export NWWS_OI_USERNAME=x # <-- change
$ export NWWS_OI_PASSWORD=y # <-- change
$ cargo run --example print
Finished dev [unoptimized + debuginfo] target(s) in 0.05s
Running `target/debug/examples/print`
[2022-02-04T01:04:56Z INFO nwws_oi] connecting to nwws-oi.weather.gov
[2022-02-04T01:04:59Z INFO nwws_oi] connected to NWWS-OI [email protected]/uuid/cda49512-b62a-46e9-87a4-1e1dd12b910b and joined channel [email protected]/x/uuid/cda49512-b62a-46e9-87a4-1e1dd12b910b
[2022-02-04T01:05:00Z INFO print] received Message {
ttaaii: "SXUS74",
cccc: "KOUN",
awips_id: Some(
"REROKC",
),
issue: 2022-02-04T00:47:00+00:00,
id: "14425.22326",
delay_stamp: Some(
2022-02-04T01:05:32.484+00:00,
),
ldm_sequence_number: Some(
109,
),
message: "SXUS74 KOUN 040104\nREROKC\n\nRECORD EVENT REPORT\nNATIONAL WEATHER SERVICE NORMAN OK\n0647 PM CST THU FEB 03 2022\n\n...RECORD DAILY MAXIMUM SNOWFALL SET AT OKLAHOMA CITY...\n\nA RECORD SNOWFALL OF 3.3 INCHES HAS FALLEN SO FAR AT WILL ROGERS \nWORLD AIRPORT OKLAHOMA CITY. THIS BREAKS THE OLD RECORD OF 1.0 SET \nON THIS DATE IN 1913. SNOW IS STILL FALLING IN OKLAHOMA CITY AT THIS \nTIME OF THIS ISSUANCE. ANOTHER REPORT WILL BE ISSUED WITH THE END OF \nTHE DAY SNOWFALL TOTALS.\n\n$$\n",
}
[2022-02-04T01:05:02Z INFO print] received Message {
ttaaii: "WOUS99",
cccc: "KNCF",
awips_id: None,
issue: 2022-02-04T01:05:00+00:00,
id: "14425.22327",
delay_stamp: None,
ldm_sequence_number: Some(
110,
),
message: "WOUS99 KNCF 040105\n@pil\nTHIS IS A COMMUNICATIONS TEST MESSAGE ORIGINATING FROM THE ANCF\nSYSTEM IN SILVER SPRING. IT IS SET TO TRANSMIT EVERY MINUTE\n24 HOURS PER DAY, SEVEN DAYS PER WEEK, VIA A CRON JOB ON THE\nCS1F-ANCF.ER SERVER. IT IS SENT TO NCF WHERE IT IS ROUTED\nEITHER VIA SBN OR WAN TO ALL AWIPS SITES. THIS PRODUCT IS USED\nFOR PERFORMANCE MEASUREMENTS AND WILL BE RECEIVED\nOVER THE WAN (NCFHPTNCF) OR SBN (NCFWTSNCF and NCFTSTNCF) BY ALL SITES.\n",
}
依赖项
~13–23MB
~332K SLoC