Pure MoonBit toolkit for parsing aviation weather reports and timelines
Safety notice: MoonAeroWx is intended for software development, education, and offline data analysis. It is not certified and must not be used for real aviation operational decisions.
| 字段 | 内容 |
|---|---|
| 项目名称 | MoonAeroWx |
| 项目标识 | jshsj124/moonaerowx |
| 项目描述 | 基于 MoonBit 的航空气象报文解析与趋势分析工具包,支持 METAR/SPECI/TAF 解析、RVR 识别、飞行类别判定、批量统计以及 JSON/Markdown/CSV 输出。 |
| 仓库地址 | https://github.com/jshsj124/MoonAeroWx |
| 包名 | jshsj124/moonaerowx |
| 许可证 | Apache-2.0 |
///|
test "decode a simple METAR" {
let result = @moonaerowx.parse_metar(
"ZBAA 171200Z 12008MPS 8000 -RA SCT020 BKN040 18/16 Q1008 NOSIG",
)
assert_false(result.has_errors())
let report = result.unwrap()
assert_eq(report.station, "ZBAA")
assert_eq(report.wind.unwrap().speed, 8)
assert_eq(report.weather[0].description, "light rain")
}///|
test "summarize a batch" {
let source = "ZBAA 171200Z 12008MPS 9999 SCT020 18/16 Q1008
ZGGG 171300Z VRB03KT 0600 FG OVC004 26/25 Q1004"
let batch = @moonaerowx.parse_metar_batch(source)
assert_eq(batch.total_reports, 2)
assert_eq(batch.lifr_count, 1)
assert_true(@moonaerowx.batch_to_markdown(batch).contains("METAR batch summary"))
assert_true(@moonaerowx.batch_to_csv(batch).contains("total_reports"))
}moon run cmd/aerowx -- decode "ZBAA 171200Z 12008MPS 8000 -RA SCT020 18/16 Q1008"
moon run cmd/aerowx -- decode-json "METAR KLAX 171253Z 25008KT 10SM FEW015 SCT250 21/16 A2992"
moon run cmd/aerowx -- decode-md "ZBAA 171200Z 12008MPS 0600 R18/P1500U FG OVC004 16/15 Q1008"
moon run cmd/aerowx -- decode-csv "ZBAA 171200Z 12008MPS 8000 -RA SCT020 18/16 Q1008"
moon run cmd/aerowx -- validate "ZBAA 171200Z 99908MPS 8000"
moon run cmd/aerowx -- timeline "TAF ZBAA 171100Z 1712/1812 12008MPS 8000 SCT020 TEMPO 1715/1718 0600 R18/0400V0800D FG OVC004 FM180000 20012MPS 9999 NSW SCT030"
moon run cmd/aerowx -- batch-csv "ZBAA 171200Z 12008MPS 9999 SCT020 18/16 Q1008
ZGGG 171300Z VRB03KT 0600 FG OVC004 26/25 Q1004"pub(all) struct BatchReport {
total_reports : Int
parsed_reports : Int
error_reports : Int
warning_reports : Int
diagnostics_count : Int
vfr_count : Int
mvfr_count : Int
ifr_count : Int
lifr_count : Int
unknown_category_count : Int
low_visibility_events : Int
low_ceiling_events : Int
} derive(Eq, Debug)pub(all) struct CloudLayer {
coverage : CloudCoverage
height_feet : Int?
cumulonimbus : Bool
towering_cumulus : Bool
} derive(Eq, Debug)pub(all) struct Diagnostic {
severity : Severity
code : DiagnosticCode
message : String
span : Span
token : String
} derive(Eq, Debug)fn Diagnostic::new(severity : Severity, code : DiagnosticCode, message : String, span : Span, token? : String) -> Diagnosticpub(all) struct MetarReport {
kind : ReportKind
station : String
observation_time : ObservationTime
automated : Bool
correction : Bool
wind : Wind?
variable_wind : VariableWindDirection?
visibility : Visibility?
rvr : Array[RunwayVisualRange]
cavok : Bool
weather : Array[Weather]
clouds : Array[CloudLayer]
temperature : Temperature?
pressure : Pressure?
trend : Trend?
remarks : Array[String]
} derive(Eq, Debug)pub(all) struct TafChangeGroup {
kind : TafChangeKind
period : TafPeriod?
from_time : TafTime?
probability_percent : Int?
conditions : TafConditions
} derive(Eq, Debug)pub(all) struct TafConditions {
wind : Wind?
variable_wind : VariableWindDirection?
visibility : Visibility?
rvr : Array[RunwayVisualRange]
cavok : Bool
weather : Array[Weather]
clouds : Array[CloudLayer]
raw_tokens : Array[String]
} derive(Eq, Debug)pub(all) struct TafReport {
station : String
issue_time : ObservationTime?
valid_period : TafPeriod
initial : TafConditions
changes : Array[TafChangeGroup]
raw : String
} derive(Eq, Debug)pub(all) struct TafTimelineEntry {
label : String
period : TafPeriod?
conditions : TafConditions
probability_percent : Int?
} derive(Eq, Debug)pub(all) struct Visibility {
value : Int
unit : VisibilityUnit
greater_than : Bool
} derive(Eq, Debug)pub(all) struct Weather {
raw : String
intensity : WeatherIntensity
description : String
} derive(Eq, Debug)Install
Download zipPure MoonBit toolkit for parsing aviation weather reports and timelines