1 ! Copyright (C) 2013 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: accessors arrays ascii assocs calendar calendar.format
5 combinators command-line continuations csv formatting fry
6 grouping http.client io io.encodings.ascii io.files io.styles
7 kernel math math.extras math.parser memoize namespaces regexp
8 sequences sorting.human splitting strings urls wrap.strings ;
12 TUPLE: station cccc name state country latitude longitude ;
18 ERROR: bad-location str ;
20 : parse-location ( str -- n )
21 "-" split dup length {
22 { 3 [ first3 [ string>number ] tri@ 60.0 / + 60.0 / + ] }
23 { 2 [ first2 [ string>number ] bi@ 60.0 / + ] }
24 { 1 [ first string>number ] }
28 : string>longitude ( str -- lon/f )
29 dup R/ \d+-\d+(-\d+(\.\d+)?)?[WE]/ matches? [
32 [ CHAR: W = [ neg ] when ] bi*
35 : string>latitude ( str -- lat/f )
36 dup R/ \d+-\d+(-\d+(\.\d+)?)?[NS]/ matches? [
39 [ CHAR: S = [ neg ] when ] bi*
42 : stations-data ( -- seq )
43 URL" http://tgftp.nws.noaa.gov/data/nsd_cccc.txt"
44 http-get nip CHAR: ; [ string>csv ] with-delimiter ;
48 MEMO: all-stations ( -- seq )
55 [ 7 swap nth string>latitude ]
56 [ 8 swap nth string>longitude ]
60 : find-by-cccc ( cccc -- station )
61 all-stations swap '[ cccc>> _ = ] find nip ;
63 : find-by-country ( country -- stations )
64 all-stations swap '[ country>> _ = ] filter ;
66 : find-by-state ( state -- stations )
67 all-stations swap '[ state>> _ = ] filter ;
71 TUPLE: metar-report type station timestamp modifier wind
72 visibility rvr weather sky-condition temperature dew-point
73 altimeter remarks raw ;
75 CONSTANT: pressure-tendency H{
76 { "0" "increasing then decreasing" }
77 { "1" "increasing more slowly" }
79 { "3" "increasing more quickly" }
81 { "5" "decreasing then increasing" }
82 { "6" "decreasing more slowly" }
84 { "8" "decreasing more quickly" }
87 CONSTANT: lightning H{
88 { "CA" "cloud-air lightning" }
89 { "CC" "cloud-cloud lightning" }
90 { "CG" "cloud-ground lightning" }
91 { "IC" "in-cloud lightning" }
98 { "DR" "low drifting" }
100 { "DU" "widespread dust" }
102 { "FC" "funnel clouds" }
107 { "GS" "small hail and/or snow pellets" }
109 { "IC" "ice crystals" }
111 { "PL" "ice pellets" }
112 { "PO" "well-developed dust/sand whirls" }
118 { "SG" "snow grains" }
123 { "TS" "thuderstorm" }
125 { "VA" "volcanic ash" }
128 MEMO: glossary ( -- assoc )
129 "vocab:metar/glossary.txt" ascii file-lines
130 [ "," split1 ] H{ } map>assoc ;
132 : parse-glossary ( str -- str' )
137 [ glossary ?at drop ] if
141 : parse-timestamp ( str -- str' )
142 [ now [ year>> ] [ month>> ] bi ] dip
143 2 cut 2 cut 2 cut drop [ string>number ] tri@
145 [ drop 0 ] dip 0 instant <timestamp> 1 days time+
147 0 instant <timestamp>
148 ] if timestamp>rfc822 ;
150 CONSTANT: compass-directions H{
170 : direction>compass ( direction -- compass )
171 22.5 round-to-step compass-directions at ;
173 : parse-compass ( str -- str' )
174 string>number [ direction>compass ] keep "%s (%s°)" sprintf ;
176 : parse-direction ( str -- str' )
177 dup "VRB" = [ drop "variable" ] [
178 parse-compass "from %s" sprintf
181 : kt>mph ( kt -- mph ) 1.15077945 * ;
183 : mph>kt ( mph -- kt ) 1.15077945 / ;
185 : parse-speed ( str units -- str'/f )
186 [ string>number ] dip '[
188 [ drop dup kt>mph "%s knots (%.1f mph)" sprintf ]
189 [ "%s %s" sprintf ] if
192 : parse-wind ( str -- str' )
193 dup "00000" head? [ drop "calm" ] [
194 "/" split1 [ 3 cut ] unless*
195 [ parse-direction ] dip {
196 { [ "KT" ?tail ] [ "knots" ] }
197 { [ "MPS" ?tail ] [ "meters per second" ] }
198 } cond [ "G" split1 ] dip '[ _ parse-speed ] bi@
199 [ "%s at %s with gusts to %s " sprintf ]
200 [ "%s at %s" sprintf ] if*
203 : parse-wind-variable ( str -- str' )
204 "V" split1 [ parse-compass ] bi@
205 ", variable from %s to %s" sprintf ;
207 : parse-visibility ( str -- str' )
210 { CHAR: M [ rest "less than " ] }
211 { CHAR: P [ rest "more than " ] }
214 CHAR: \s over index [ " " "+" replace ] when
215 string>number "%s%s statute miles" sprintf
219 { [ dup 800 < ] [ "%dm" sprintf ] }
220 { [ dup 5000 < ] [ 1000 /f "%.1fkm" sprintf ] }
221 { [ dup 9999 < ] [ 1000 /f "%dkm" sprintf ] }
222 [ drop "more than 10km" ]
232 ] { } map-as unclip-last
233 [ "-" join ] dip append " " glue
237 : parse-rvr ( str -- str' )
239 { [ "U" ?tail ] [ " with improvement" ] }
240 { [ "D" ?tail ] [ " with aggravation" ] }
241 { [ "N" ?tail ] [ " with no change" ] }
244 "R" ?head drop "/" split1 "FT" ?tail [
246 [ string>number ] bi@
247 "varying between %s and %s" sprintf
249 string>number "of %s" sprintf
250 ] if* "runway %s visibility %s" sprintf
251 ] dip " ft" " meters" ? append
254 : (parse-weather) ( str -- str' )
255 dup "+FC" = [ drop "tornadoes or waterspouts" ] [
257 { CHAR: + [ rest "heavy " ] }
258 { CHAR: - [ rest "light " ] }
261 2 group dup [ weather key? ] all?
262 [ [ weather at ] map " " join ]
263 [ concat parse-glossary ] if
267 : parse-weather ( str -- str' )
268 "VC" over subseq? [ "VC" "" replace t ] [ f ] if
270 [ [ " in the vicinity" append ] when ] bi* ;
272 : parse-altitude ( str -- str' )
273 string>number " at %s00 ft" sprintf ;
279 { "SCT" "scattered" }
280 { "SKC" "clear sky" }
281 { "CLR" "clear sky" }
282 { "NSC" "clear sky" }
284 { "ACC" "altocumulus castellanus" }
285 { "ACSL" "standing lenticular altocumulus" }
286 { "CCSL" "cirrocumulus standing lenticular cloud" }
288 { "SC" "stratocumulus" }
289 { "SCSL" "stratocumulus standing lenticular cloud" }
290 { "TCU" "towering cumulus" }
293 : parse-sky-condition ( str -- str' )
298 [ sky at [ " (%s)" sprintf ] [ f ] if* ]
302 : F>C ( F -- C ) 32 - 5/9 * ;
304 : C>F ( C -- F ) 9/5 * 32 + ;
306 : parse-temperature ( str -- temp dew-point )
309 "M" ?head [ string>number ] [ [ neg ] when ] bi*
310 dup C>F "%d °C (%.1f °F)" sprintf
314 : parse-altimeter ( str -- str' )
315 unclip [ string>number ] [ CHAR: A = ] bi*
316 [ 100 /f "%.2f Hg" sprintf ] [ "%s hPa" sprintf ] if ;
318 CONSTANT: re-timestamp R/ \d{6}Z/
319 CONSTANT: re-station R/ \w{4}/
320 CONSTANT: re-temperature R/ [M]?\d{2}\/([M]?\d{2})?/
321 CONSTANT: re-wind R/ (VRB|\d{3})(\/\d+|\d{2,3})(G\d{2,3})?(KT|MPS)/
322 CONSTANT: re-wind-variable R/ \d{3}V\d{3}/
323 CONSTANT: re-visibility R/ ((\d+|[MP])?\d+(\/\d+)?SM|\d{4}[NSEW]{0,2})/
324 CONSTANT: re-rvr R/ R\d{2}[RLC]?\/[MP]?\d{4}(V\d{4})?(FT)?[UDN]?/
325 CONSTANT: re-weather R/ [+-]?(VC)?(\w{2}|\w{4})/
326 CONSTANT: re-sky-condition R/ (\w{2,3}\d{3}(\w+)?|\w{3}|CAVOK)/
327 CONSTANT: re-altimeter R/ [AQ]\d{4}/
329 : find-one ( seq quot: ( elt -- ? ) -- seq' elt/f )
330 dupd find [ [ swap remove-nth ] when* ] dip ; inline
332 : find-all ( seq quot: ( elt -- ? ) -- seq elts )
333 [ dupd find drop ] keep '[
335 [ dup ?first _ [ f ] if* ] [ unclip ] produce
339 : fix-visibility ( seq -- seq' )
340 dup [ R/ \d+(\/\d+)?SM/ matches? ] find drop [
341 dup 1 - pick ?nth [ R/ \d+/ matches? ] [ f ] if* [
342 cut [ unclip-last ] [ unclip swap ] bi*
343 [ " " glue 1array ] [ 3append ] bi*
347 : metar-body ( report seq -- report )
348 [ { "METAR" "SPECI" } member? ] find-one
349 [ pick type<< ] when*
351 [ re-station matches? ] find-one
352 [ pick station<< ] when*
354 [ re-timestamp matches? ] find-one
355 [ parse-timestamp pick timestamp<< ] when*
357 [ { "AUTO" "COR" } member? ] find-one
358 [ pick modifier<< ] when*
360 [ re-wind matches? ] find-one
361 [ parse-wind pick wind<< ] when*
363 [ re-wind-variable matches? ] find-one
364 [ parse-wind-variable pick wind>> prepend pick wind<< ] when*
367 [ re-visibility matches? ] find-all
368 [ parse-visibility ] map ", " join pick visibility<<
370 [ re-rvr matches? ] find-all
371 [ parse-rvr ] map ", " join pick rvr<<
373 [ re-weather matches? ] find-all
374 [ parse-weather ] map ", " join pick weather<<
376 [ re-sky-condition matches? ] find-all
377 [ parse-sky-condition ] map ", " join pick sky-condition<<
379 [ re-temperature matches? ] find-one
382 [ pick temperature<< ]
383 [ pick dew-point<< ] bi*
386 [ re-altimeter matches? ] find-one
387 [ parse-altimeter pick altimeter<< ] when*
391 : signed-number ( sign value -- n )
392 [ string>number ] bi@ swap zero? [ neg ] unless 10.0 / ;
394 : single-value ( str -- str' )
395 1 cut signed-number ;
397 : double-value ( str -- m n )
398 1 cut 3 cut [ signed-number ] dip 1 cut signed-number ;
400 : parse-1hr-temp ( str -- str' )
401 "T" ?head drop dup length 4 > [
403 [ dup C>F "%.1f °C (%.1f °F)" sprintf ] bi@
404 "hourly temperature %s and dew point %s" sprintf
407 "hourly temperature %.1f °C (%.1f °F)" sprintf
410 : parse-6hr-max-temp ( str -- str' )
411 "1" ?head drop single-value dup C>F
412 "6-hour maximum temperature %.1f °C (%.1f °F)" sprintf ;
414 : parse-6hr-min-temp ( str -- str' )
415 "2" ?head drop single-value dup C>F
416 "6-hour minimum temperature %.1f °C (%.1f °F)" sprintf ;
418 : parse-24hr-temp ( str -- str' )
419 "4" ?head drop double-value
420 [ dup C>F "%.1f °C (%.1f °F)" sprintf ] bi@
421 "24-hour maximum temperature %s minimum temperature %s"
424 : parse-1hr-pressure ( str -- str' )
425 "5" ?head drop 1 cut single-value [ pressure-tendency at ] dip
426 "hourly pressure %s %s hPa" sprintf ;
428 : parse-snow-depth ( str -- str' )
429 "4/" ?head drop string>number "snow depth %s inches" sprintf ;
431 CONSTANT: low-clouds H{
432 { 1 "cumulus (fair weather)" }
433 { 2 "cumulus (towering)" }
434 { 3 "cumulonimbus (no anvil)" }
435 { 4 "stratocumulus (from cumulus)" }
436 { 5 "stratocumuls (not cumulus)" }
437 { 6 "stratus or Fractostratus (fair)" }
438 { 7 "fractocumulus / fractostratus (bad weather)" }
439 { 8 "cumulus and stratocumulus" }
440 { 9 "cumulonimbus (thunderstorm)" }
444 CONSTANT: mid-clouds H{
445 { 1 "altostratus (thin)" }
446 { 2 "altostratus (thick)" }
447 { 3 "altocumulus (thin)" }
448 { 4 "altocumulus (patchy)" }
449 { 5 "altocumulus (thickening)" }
450 { 6 "altocumulus (from cumulus)" }
451 { 7 "altocumulus (with altocumulus, altostratus, nimbostratus)" }
452 { 8 "altocumulus (with turrets)" }
453 { 9 "altocumulus (chaotic)" }
454 { -1 "above overcast" }
457 CONSTANT: high-clouds H{
458 { 1 "cirrus (filaments)" }
459 { 2 "cirrus (dense)" }
460 { 3 "cirrus (often with cumulonimbus)" }
461 { 4 "cirrus (thickening)" }
462 { 5 "cirrus / cirrostratus (low in sky)" }
463 { 6 "cirrus / cirrostratus (hi in sky)" }
464 { 7 "cirrostratus (entire sky)" }
465 { 8 "cirrostratus (partial)" }
466 { 9 "cirrocumulus or cirrocumulus / cirrus / cirrostratus" }
467 { -1 "above overcast" }
470 : parse-cloud-cover ( str -- str' )
471 "8/" ?head drop first3 [ CHAR: 0 - ] tri@
472 [ [ f ] [ low-clouds at "low clouds are %s" sprintf ] if-zero ]
473 [ [ f ] [ mid-clouds at "middle clouds are %s" sprintf ] if-zero ]
474 [ [ f ] [ high-clouds at "high clouds are %s" sprintf ] if-zero ]
475 tri* 3array " " join ;
477 : parse-inches ( str -- str' )
478 dup [ CHAR: / = ] all? [ drop "unknown" ] [
480 [ "trace" ] [ 100 /f "%.2f inches" sprintf ] if-zero
483 : parse-1hr-precipitation ( str -- str' )
484 "P" ?head drop parse-inches
485 "%s precipitation in last hour" sprintf ;
487 : parse-6hr-precipitation ( str -- str' )
488 "6" ?head drop parse-inches
489 "%s precipitation in last 6 hours" sprintf ;
491 : parse-24hr-precipitation ( str -- str' )
492 "7" ?head drop parse-inches
493 "%s precipitation in last 24 hours" sprintf ;
495 ! XXX: "on the hour" instead of "00 minutes past the hour" ?
497 : parse-recent-time ( str -- str' )
500 [ " minutes past the hour" append ] if ;
502 : parse-peak-wind ( str -- str' )
503 "/" split1 [ parse-wind ] [ parse-recent-time ] bi*
504 "%s occuring at %s" sprintf ;
506 : parse-sea-level-pressure ( str -- str' )
507 "SLP" ?head drop string>number 10.0 /f 1000 +
508 "sea-level pressure is %s hPa" sprintf ;
510 : parse-lightning ( str -- str' )
511 "LTG" ?head drop 2 group [ lightning at ] map " " join ;
513 CONSTANT: re-recent-weather R/ ((\w{2})?[BE]\d{2,4}((\w{2})?[BE]\d{2,4})?)+/
515 : parse-began/ended ( str -- str' )
517 [ CHAR: B = "began" "ended" ? ]
518 [ parse-recent-time ] bi* "%s at %s" sprintf ;
520 : split-recent-weather ( str -- seq )
522 dup [ digit? ] find drop
523 over [ digit? not ] find-from drop
524 [ cut ] [ f ] if* swap
527 : (parse-recent-weather) ( str -- str' )
528 dup [ digit? ] find drop 2 > [
529 2 cut [ weather at " " append ] dip
530 ] [ f swap ] if parse-began/ended "" append-as ;
532 : parse-recent-weather ( str -- str' )
534 [ (parse-recent-weather) ] map " " join ;
536 : parse-varying ( str -- str' )
537 "V" split1 [ string>number ] bi@
538 "varying between %s00 and %s00 ft" sprintf ;
540 : parse-from-to ( str -- str' )
541 "-" split [ parse-glossary ] map " to " join ;
543 : parse-water-equivalent-snow ( str -- str' )
544 "933" ?head drop parse-inches
545 "%s water equivalent of snow on ground" sprintf ;
547 : parse-duration-of-sunshine ( str -- str' )
548 "98" ?head drop string>number
549 [ "no" ] [ "%s minutes of" sprintf ] if-zero
550 "%s sunshine" sprintf ;
552 : parse-6hr-snowfall ( str -- str' )
553 "931" ?head drop parse-inches
554 "%s snowfall in last 6 hours" sprintf ;
556 : parse-probability ( str -- str' )
557 "PROB" ?head drop string>number
558 "probability of %d%%" sprintf ;
560 : parse-remark ( str -- str' )
562 { [ dup glossary key? ] [ glossary at ] }
563 { [ dup R/ 1\d{4}/ matches? ] [ parse-6hr-max-temp ] }
564 { [ dup R/ 2\d{4}/ matches? ] [ parse-6hr-min-temp ] }
565 { [ dup R/ 4\d{8}/ matches? ] [ parse-24hr-temp ] }
566 { [ dup R/ 4\/\d{3}/ matches? ] [ parse-snow-depth ] }
567 { [ dup R/ 5\d{4}/ matches? ] [ parse-1hr-pressure ] }
568 { [ dup R/ 6[\d\/]{4}/ matches? ] [ parse-6hr-precipitation ] }
569 { [ dup R/ 7\d{4}/ matches? ] [ parse-24hr-precipitation ] }
570 { [ dup R/ 8\/\d{3}/ matches? ] [ parse-cloud-cover ] }
571 { [ dup R/ 931\d{3}/ matches? ] [ parse-6hr-snowfall ] }
572 { [ dup R/ 933\d{3}/ matches? ] [ parse-water-equivalent-snow ] }
573 { [ dup R/ 98\d{3}/ matches? ] [ parse-duration-of-sunshine ] }
574 { [ dup R/ T\d{4,8}/ matches? ] [ parse-1hr-temp ] }
575 { [ dup R/ \d{3}\d{2,3}\/\d{2,4}/ matches? ] [ parse-peak-wind ] }
576 { [ dup R/ P\d{4}/ matches? ] [ parse-1hr-precipitation ] }
577 { [ dup R/ SLP\d{3}/ matches? ] [ parse-sea-level-pressure ] }
578 { [ dup R/ LTG\w+/ matches? ] [ parse-lightning ] }
579 { [ dup R/ PROB\d+/ matches? ] [ parse-probability ] }
580 { [ dup R/ \d{3}V\d{3}/ matches? ] [ parse-varying ] }
581 { [ dup R/ [^-]+(-[^-]+)+/ matches? ] [ parse-from-to ] }
582 { [ dup R/ [^\/]+(\/[^\/]+)+/ matches? ] [ ] }
583 { [ dup R/ \d+.\d+/ matches? ] [ ] }
584 { [ dup re-recent-weather matches? ] [ parse-recent-weather ] }
585 { [ dup re-weather matches? ] [ parse-weather ] }
586 { [ dup re-sky-condition matches? ] [ parse-sky-condition ] }
590 : metar-remarks ( report seq -- report )
591 [ parse-remark ] map " " join >>remarks ;
593 : <metar-report> ( metar -- report )
594 [ metar-report new ] dip [ >>raw ] keep
595 [ blank? ] split-when { "RMK" } split1
596 [ metar-body ] [ metar-remarks ] bi* ;
598 : row. ( name quot -- )
600 [ _ write ] with-cell
601 [ @ [ 65 wrap-string write ] when* ] with-cell
604 : metar-report. ( report -- )
605 standard-table-style [
607 [ "Station" [ station>> ] row. ]
608 [ "Timestamp" [ timestamp>> ] row. ]
609 [ "Wind" [ wind>> ] row. ]
610 [ "Visibility" [ visibility>> ] row. ]
611 [ "RVR" [ rvr>> ] row. ]
612 [ "Weather" [ weather>> ] row. ]
613 [ "Sky condition" [ sky-condition>> ] row. ]
614 [ "Temperature" [ temperature>> ] row. ]
615 [ "Dew point" [ dew-point>> ] row. ]
616 [ "Altimeter" [ altimeter>> ] row. ]
617 [ "Remarks" [ remarks>> ] row. ]
618 [ "Raw Text" [ raw>> ] row. ]
620 ] tabular-output nl ;
624 GENERIC: metar ( station -- metar )
626 M: station metar cccc>> metar ;
629 "http://tgftp.nws.noaa.gov/data/observations/metar/stations/%s.TXT"
630 sprintf http-get nip ;
632 GENERIC: metar. ( station -- )
634 M: station metar. cccc>> metar. ;
637 [ metar <metar-report> metar-report. ]
638 [ drop "%s METAR not found\n" printf ] recover ;
642 : parse-wind-shear ( str -- str' )
643 "WS" ?head drop "/" split1
644 [ parse-altitude ] [ parse-wind ] bi* prepend
645 "wind shear " prepend ;
647 CONSTANT: re-from-timestamp R/ FM\d{6}/
649 : parse-from-timestamp ( str -- str' )
650 "FM" ?head drop parse-timestamp ;
652 CONSTANT: re-valid-timestamp R/ \d{4}\/\d{4}/
654 : parse-valid-timestamp ( str -- str' )
655 "/" split1 [ "00" append parse-timestamp ] bi@ " to " glue ;
657 TUPLE: taf-report station timestamp valid-timestamp wind
658 visibility rvr weather sky-condition partials raw ;
660 TUPLE: taf-partial from-timestamp wind visibility rvr weather
663 : taf-body ( report str -- report )
664 [ blank? ] split-when
666 [ "TAF" = ] find-one drop
668 [ { "AMD" "COR" "RTD" } member? ] find-one drop
670 [ re-station matches? ] find-one
671 [ pick station<< ] when*
673 [ re-timestamp matches? ] find-one
674 [ parse-timestamp pick timestamp<< ] when*
676 [ re-valid-timestamp matches? ] find-one
677 [ parse-valid-timestamp pick valid-timestamp<< ] when*
679 [ re-wind matches? ] find-one
680 [ parse-wind pick wind<< ] when*
682 [ re-wind-variable matches? ] find-one
683 [ parse-wind-variable pick wind>> prepend pick wind<< ] when*
685 [ re-visibility matches? ] find-one
686 [ parse-visibility pick visibility<< ] when*
688 [ re-rvr matches? ] find-all " " join
689 [ parse-rvr ] map ", " join pick rvr<<
691 [ re-weather matches? ] find-all
692 [ parse-weather ] map ", " join pick weather<<
694 [ re-sky-condition matches? ] find-all
695 [ parse-sky-condition ] map ", " join pick sky-condition<<
699 : <taf-partial> ( str -- partial )
700 [ taf-partial new ] dip [ blank? ] split-when
702 [ re-from-timestamp matches? ] find-one
703 [ parse-from-timestamp pick from-timestamp<< ] when*
705 [ re-wind matches? ] find-one
706 [ parse-wind pick wind<< ] when*
708 [ re-wind-variable matches? ] find-one
709 [ parse-wind-variable pick wind>> prepend pick wind<< ] when*
711 [ re-visibility matches? ] find-one
712 [ parse-visibility pick visibility<< ] when*
714 [ re-rvr matches? ] find-all " " join
715 [ parse-rvr ] map ", " join pick rvr<<
717 [ re-weather matches? ] find-all
718 [ parse-weather ] map ", " join pick weather<<
720 [ re-sky-condition matches? ] find-all
721 [ parse-sky-condition ] map ", " join pick sky-condition<<
725 : taf-partials ( report seq -- report )
726 [ <taf-partial> ] map >>partials ;
728 : <taf-report> ( taf -- report )
729 [ taf-report new ] dip [ >>raw ] keep
730 string-lines [ [ blank? ] trim ] map
731 rest dup first "TAF" = [ rest ] when
732 harvest unclip swapd taf-body swap taf-partials ;
734 : taf-report. ( report -- )
736 standard-table-style [
738 [ "Station" [ station>> ] row. ]
739 [ "Timestamp" [ timestamp>> ] row. ]
740 [ "Valid From" [ valid-timestamp>> ] row. ]
741 [ "Wind" [ wind>> ] row. ]
742 [ "Visibility" [ visibility>> ] row. ]
743 [ "RVR" [ rvr>> ] row. ]
744 [ "Weather" [ weather>> ] row. ]
745 [ "Sky condition" [ sky-condition>> ] row. ]
746 [ "Raw Text" [ raw>> ] row. ]
751 standard-table-style [
753 [ "From" [ from-timestamp>> ] row. ]
754 [ "Wind" [ wind>> ] row. ]
755 [ "Visibility" [ visibility>> ] row. ]
756 [ "RVR" [ rvr>> ] row. ]
757 [ "Weather" [ weather>> ] row. ]
758 [ "Sky condition" [ sky-condition>> ] row. ]
766 GENERIC: taf ( station -- taf )
768 M: station taf cccc>> taf ;
771 "http://tgftp.nws.noaa.gov/data/forecasts/taf/stations/%s.TXT"
772 sprintf http-get nip ;
774 GENERIC: taf. ( station -- )
776 M: station taf. cccc>> taf. ;
779 [ taf <taf-report> taf-report. ]
780 [ drop "%s TAF not found\n" printf ] recover ;
784 [ metar print ] [ taf print ] bi nl