metar-body ( report seq -- report )


Vocabulary
metar.private

Inputs
reportan object
seqan object


Outputs
reportan object


Definition


: metar-body ( report seq -- report )
[ { "METAR" "SPECI" } member? ] find-one
[ pick type<< ] when* [ re-station matches? ] find-one
[ pick station<< ] when* [ re-timestamp matches? ] find-one
[ parse-timestamp pick timestamp<< ] when*
[ { "AUTO" "COR" } member? ] find-all join-words pick
modifier<< [ "NIL" = ] find-one [ pick status<< ] when*
[ re-wind matches? ] find-one
[ parse-wind pick wind<< ] when*
[ re-wind-variable matches? ] find-one
[ parse-wind-variable pick wind>> swap append pick wind<< ]
when* fix-visibility [ re-visibility matches? ] find-all
[ parse-visibility ] map ", " join pick visibility<<
[ "CAVOK" = ] find-one [
drop "10km or more" pick visibility<<
"no significant weather" pick weather<<
"no significant cloud" pick sky-condition<<
] when* [ re-rvr matches? ] find-all [ parse-rvr ] map
", " join pick rvr<< [ weather-group? ] find-all dup empty?
[ drop ] [ [ parse-weather ] map ", " join pick weather<< ]
if [ re-sky-condition matches? ] find-all dup empty?
[ drop ] [
[ parse-sky-condition ] map ", " join
pick sky-condition<<
] if [ re-temperature matches? ] find-one [
parse-temperature
[ pick temperature<< ] [ pick dew-point<< ] bi*
] when* [ re-altimeter matches? ] find-one
[ parse-altimeter pick altimeter<< ] when*
[ re-runway-state matches? ] find-all
[ parse-runway-state ] map "; " join pick runway-state<<
[ re-wind-shear matches? ] find-all [ parse-wind-shear ] map
", " join pick wind-shear<<
[ re-sea-condition matches? ] find-all
[ parse-sea-condition ] map ", " join pick sea-condition<<
>>unparsed ;