parse-visibility ( str -- str' )


Vocabulary
metar.private

Inputs
stran object


Outputs
str'an object


Definition


: parse-visibility ( str -- str' )
dup "////" =
[ drop "visibility unavailable" ] [
"SM" ?tail [
dup first {
{ 77 [ rest "less than " ] }
{ 80 [ rest "more than " ] }
[ drop "" ]
} case swap "%s%s statute miles" sprintf
] [
"NDV" ?tail drop 4 cut [
string>number {
{ ~quotation~ ~quotation~ }
{ ~quotation~ ~quotation~ }
{ ~quotation~ ~quotation~ }
{ ~quotation~ ~quotation~ }
[ drop "10km or more" ]
} cond
] dip [
[
H{
{ 83 "south" }
{ 69 "east" }
{ 78 "north" }
{ 87 "west" }
} at
] { } map-as unclip-last [ "-" join ] dip append
" " glue
] unless-empty
] if
] if ;