parse-wind ( str -- str' )


Vocabulary
metar.private

Inputs
stran object


Outputs
str'an object


Definition


: parse-wind ( str -- str' )
dup "00000" head?
[ drop "calm" ] [
"/" split1 [ 3 cut ] unless* [ parse-direction ] dip {
{ [ "KT" ?tail ] [ "knots" ] }
{ [ "MPS" ?tail ] [ "meters per second" ] }
[ "knots" ]
} cond [ "G" split1 ] dip [ parse-speed ] curry bi@
[ "%s at %s with gusts to %s " sprintf ]
[ "%s at %s" sprintf ] if*
] if ;