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 classes.tuple combinators command-line continuations csv
6 formatting grouping http.client io io.encodings.ascii io.files
7 io.styles kernel math math.extras math.parser 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 : all-stations. ( -- )
61 all-stations standard-table-style [
67 dup string? [ "%.2f" sprintf ] unless write
75 : find-by-cccc ( cccc -- station )
76 all-stations swap '[ cccc>> _ = ] find nip ;
78 : find-by-country ( country -- stations )
79 all-stations swap '[ country>> _ = ] filter ;
81 : find-by-state ( state -- stations )
82 all-stations swap '[ state>> _ = ] filter ;
86 TUPLE: metar-report type station timestamp modifier wind
87 visibility rvr weather sky-condition temperature dew-point
88 altimeter remarks raw ;
90 CONSTANT: pressure-tendency H{
91 { "0" "increasing then decreasing" }
92 { "1" "increasing more slowly" }
94 { "3" "increasing more quickly" }
96 { "5" "decreasing then increasing" }
97 { "6" "decreasing more slowly" }
99 { "8" "decreasing more quickly" }
102 CONSTANT: lightning H{
103 { "CA" "cloud-air lightning" }
104 { "CC" "cloud-cloud lightning" }
105 { "CG" "cloud-ground lightning" }
106 { "IC" "in-cloud lightning" }
113 { "DR" "low drifting" }
115 { "DU" "widespread dust" }
117 { "FC" "funnel clouds" }
122 { "GS" "small hail and/or snow pellets" }
124 { "IC" "ice crystals" }
126 { "PL" "ice pellets" }
127 { "PO" "well-developed dust/sand whirls" }
133 { "SG" "snow grains" }
138 { "TS" "thuderstorm" }
140 { "VA" "volcanic ash" }
143 MEMO: glossary ( -- assoc )
144 "vocab:metar/glossary.txt" ascii file-lines
145 [ "," split1 ] H{ } map>assoc ;
147 : parse-glossary ( str -- str' )
152 [ glossary ?at drop ] if
156 : parse-timestamp ( str -- str' )
157 [ now [ year>> ] [ month>> ] bi ] dip
158 2 cut 2 cut 2 cut drop [ string>number ] tri@
160 [ drop 0 ] dip 0 instant <timestamp> 1 days time+
162 0 instant <timestamp>
163 ] if timestamp>rfc822 ;
165 CONSTANT: compass-directions H{
185 : direction>compass ( direction -- compass )
186 22.5 round-to-step compass-directions at ;
188 : parse-compass ( str -- str' )
189 string>number [ direction>compass ] keep "%s (%s°)" sprintf ;
191 : parse-direction ( str -- str' )
192 dup "VRB" = [ drop "variable" ] [
193 parse-compass "from %s" sprintf
196 : kt>mph ( kt -- mph ) 1.15077945 * ;
198 : mph>kt ( mph -- kt ) 1.15077945 / ;
200 : parse-speed ( str units -- str'/f )
201 [ string>number ] dip '[
203 [ drop dup kt>mph "%s knots (%.1f mph)" sprintf ]
204 [ "%s %s" sprintf ] if
207 : parse-wind ( str -- str' )
208 dup "00000" head? [ drop "calm" ] [
209 "/" split1 [ 3 cut ] unless*
210 [ parse-direction ] dip {
211 { [ "KT" ?tail ] [ "knots" ] }
212 { [ "MPS" ?tail ] [ "meters per second" ] }
213 } cond [ "G" split1 ] dip '[ _ parse-speed ] bi@
214 [ "%s at %s with gusts to %s " sprintf ]
215 [ "%s at %s" sprintf ] if*
218 : parse-wind-variable ( str -- str' )
219 "V" split1 [ parse-compass ] bi@
220 ", variable from %s to %s" sprintf ;
222 : parse-visibility ( str -- str' )
225 { CHAR: M [ rest "less than " ] }
226 { CHAR: P [ rest "more than " ] }
229 CHAR: \s over index [ " " "+" replace ] when
230 string>number "%s%s statute miles" sprintf
234 { [ dup 800 < ] [ "%dm" sprintf ] }
235 { [ dup 5000 < ] [ 1000 /f "%.1fkm" sprintf ] }
236 { [ dup 9999 < ] [ 1000 /f "%dkm" sprintf ] }
237 [ drop "more than 10km" ]
247 ] { } map-as unclip-last
248 [ "-" join ] dip append " " glue
252 : parse-rvr ( str -- str' )
254 { [ "U" ?tail ] [ " with improvement" ] }
255 { [ "D" ?tail ] [ " with aggravation" ] }
256 { [ "N" ?tail ] [ " with no change" ] }
259 "R" ?head drop "/" split1 "FT" ?tail [
261 [ string>number ] bi@
262 "varying between %s and %s" sprintf
264 string>number "of %s" sprintf
265 ] if* "runway %s visibility %s" sprintf
266 ] dip " ft" " meters" ? append
269 : (parse-weather) ( str -- str' )
270 dup "+FC" = [ drop "tornadoes or waterspouts" ] [
272 { CHAR: + [ rest "heavy " ] }
273 { CHAR: - [ rest "light " ] }
276 2 group dup [ weather key? ] all?
277 [ [ weather at ] map join-words ]
278 [ concat parse-glossary ] if
282 : parse-weather ( str -- str' )
283 "VC" over subseq? [ "VC" "" replace t ] [ f ] if
285 [ [ " in the vicinity" append ] when ] bi* ;
287 : parse-altitude ( str -- str' )
288 string>number " at %s00 ft" sprintf ;
294 { "SCT" "scattered" }
295 { "SKC" "clear sky" }
296 { "CLR" "clear sky" }
297 { "NSC" "clear sky" }
299 { "ACC" "altocumulus castellanus" }
300 { "ACSL" "standing lenticular altocumulus" }
301 { "CCSL" "cirrocumulus standing lenticular cloud" }
303 { "SC" "stratocumulus" }
304 { "SCSL" "stratocumulus standing lenticular cloud" }
305 { "TCU" "towering cumulus" }
308 : parse-sky-condition ( str -- str' )
313 [ sky at [ " (%s)" sprintf ] [ f ] if* ]
317 : F>C ( F -- C ) 32 - 5/9 * ;
319 : C>F ( C -- F ) 9/5 * 32 + ;
321 : parse-temperature ( str -- temp dew-point )
324 "M" ?head [ string>number ] [ [ neg ] when ] bi*
325 dup C>F "%d °C (%.1f °F)" sprintf
329 : parse-altimeter ( str -- str' )
330 unclip [ string>number ] [ CHAR: A = ] bi*
331 [ 100 /f "%.2f Hg" sprintf ] [ "%s hPa" sprintf ] if ;
333 CONSTANT: re-timestamp R/ \d{6}Z/
334 CONSTANT: re-station R/ \w{4}/
335 CONSTANT: re-temperature R/ [M]?\d{2}\/([M]?\d{2})?/
336 CONSTANT: re-wind R/ (VRB|\d{3})(\/\d+|\d{2,3})(G\d{2,3})?(KT|MPS)/
337 CONSTANT: re-wind-variable R/ \d{3}V\d{3}/
338 CONSTANT: re-visibility R/ ((\d+|[MP])?\d+(\/\d+)?SM|\d{4}[NSEW]{0,2})/
339 CONSTANT: re-rvr R/ R\d{2}[RLC]?\/[MP]?\d{4}(V\d{4})?(FT)?[UDN]?/
340 CONSTANT: re-weather R/ [+-]?(VC)?(\w{2}|\w{4})/
341 CONSTANT: re-sky-condition R/ (\w{2,3}\d{3}(\w+)?|\w{3}|CAVOK)/
342 CONSTANT: re-altimeter R/ [AQ]\d{4}/
344 : find-one ( seq quot: ( elt -- ? ) -- seq' elt/f )
345 dupd find [ [ swap remove-nth ] when* ] dip ; inline
347 : find-all ( seq quot: ( elt -- ? ) -- seq elts )
348 [ dupd find drop ] keep '[
350 [ dup ?first _ [ f ] if* ] [ unclip ] produce
354 : fix-visibility ( seq -- seq' )
355 dup [ R/ \d+(\/\d+)?SM/ matches? ] find drop [
356 dup 1 - pick ?nth [ R/ \d+/ matches? ] [ f ] if* [
357 cut [ unclip-last ] [ unclip swap ] bi*
358 [ " " glue 1array ] [ 3append ] bi*
362 : metar-body ( report seq -- report )
363 [ { "METAR" "SPECI" } member? ] find-one
364 [ pick type<< ] when*
366 [ re-station matches? ] find-one
367 [ pick station<< ] when*
369 [ re-timestamp matches? ] find-one
370 [ parse-timestamp pick timestamp<< ] when*
372 [ { "AUTO" "COR" } member? ] find-one
373 [ pick modifier<< ] when*
375 [ re-wind matches? ] find-one
376 [ parse-wind pick wind<< ] when*
378 [ re-wind-variable matches? ] find-one
379 [ parse-wind-variable pick wind>> prepend pick wind<< ] when*
382 [ re-visibility matches? ] find-all
383 [ parse-visibility ] map ", " join pick visibility<<
385 [ re-rvr matches? ] find-all
386 [ parse-rvr ] map ", " join pick rvr<<
388 [ re-weather matches? ] find-all
389 [ parse-weather ] map ", " join pick weather<<
391 [ re-sky-condition matches? ] find-all
392 [ parse-sky-condition ] map ", " join pick sky-condition<<
394 [ re-temperature matches? ] find-one
397 [ pick temperature<< ]
398 [ pick dew-point<< ] bi*
401 [ re-altimeter matches? ] find-one
402 [ parse-altimeter pick altimeter<< ] when*
406 : signed-number ( sign value -- n )
407 [ string>number ] bi@ swap zero? [ neg ] unless 10.0 / ;
409 : single-value ( str -- str' )
410 1 cut signed-number ;
412 : double-value ( str -- m n )
413 1 cut 3 cut [ signed-number ] dip 1 cut signed-number ;
415 : parse-1hr-temp ( str -- str' )
416 "T" ?head drop dup length 4 > [
418 [ dup C>F "%.1f °C (%.1f °F)" sprintf ] bi@
419 "hourly temperature %s and dew point %s" sprintf
422 "hourly temperature %.1f °C (%.1f °F)" sprintf
425 : parse-6hr-max-temp ( str -- str' )
426 "1" ?head drop single-value dup C>F
427 "6-hour maximum temperature %.1f °C (%.1f °F)" sprintf ;
429 : parse-6hr-min-temp ( str -- str' )
430 "2" ?head drop single-value dup C>F
431 "6-hour minimum temperature %.1f °C (%.1f °F)" sprintf ;
433 : parse-24hr-temp ( str -- str' )
434 "4" ?head drop double-value
435 [ dup C>F "%.1f °C (%.1f °F)" sprintf ] bi@
436 "24-hour maximum temperature %s minimum temperature %s"
439 : parse-1hr-pressure ( str -- str' )
440 "5" ?head drop 1 cut single-value [ pressure-tendency at ] dip
441 "hourly pressure %s %s hPa" sprintf ;
443 : parse-snow-depth ( str -- str' )
444 "4/" ?head drop string>number "snow depth %s inches" sprintf ;
446 CONSTANT: low-clouds H{
447 { 1 "cumulus (fair weather)" }
448 { 2 "cumulus (towering)" }
449 { 3 "cumulonimbus (no anvil)" }
450 { 4 "stratocumulus (from cumulus)" }
451 { 5 "stratocumuls (not cumulus)" }
452 { 6 "stratus or Fractostratus (fair)" }
453 { 7 "fractocumulus / fractostratus (bad weather)" }
454 { 8 "cumulus and stratocumulus" }
455 { 9 "cumulonimbus (thunderstorm)" }
459 CONSTANT: mid-clouds H{
460 { 1 "altostratus (thin)" }
461 { 2 "altostratus (thick)" }
462 { 3 "altocumulus (thin)" }
463 { 4 "altocumulus (patchy)" }
464 { 5 "altocumulus (thickening)" }
465 { 6 "altocumulus (from cumulus)" }
466 { 7 "altocumulus (with altocumulus, altostratus, nimbostratus)" }
467 { 8 "altocumulus (with turrets)" }
468 { 9 "altocumulus (chaotic)" }
469 { -1 "above overcast" }
472 CONSTANT: high-clouds H{
473 { 1 "cirrus (filaments)" }
474 { 2 "cirrus (dense)" }
475 { 3 "cirrus (often with cumulonimbus)" }
476 { 4 "cirrus (thickening)" }
477 { 5 "cirrus / cirrostratus (low in sky)" }
478 { 6 "cirrus / cirrostratus (hi in sky)" }
479 { 7 "cirrostratus (entire sky)" }
480 { 8 "cirrostratus (partial)" }
481 { 9 "cirrocumulus or cirrocumulus / cirrus / cirrostratus" }
482 { -1 "above overcast" }
485 : parse-cloud-cover ( str -- str' )
486 "8/" ?head drop first3 [ CHAR: 0 - ] tri@
487 [ [ f ] [ low-clouds at "low clouds are %s" sprintf ] if-zero ]
488 [ [ f ] [ mid-clouds at "middle clouds are %s" sprintf ] if-zero ]
489 [ [ f ] [ high-clouds at "high clouds are %s" sprintf ] if-zero ]
490 tri* 3array join-words ;
492 : parse-inches ( str -- str' )
493 dup [ CHAR: / = ] all? [ drop "unknown" ] [
495 [ "trace" ] [ 100 /f "%.2f inches" sprintf ] if-zero
498 : parse-1hr-precipitation ( str -- str' )
499 "P" ?head drop parse-inches
500 "%s precipitation in last hour" sprintf ;
502 : parse-6hr-precipitation ( str -- str' )
503 "6" ?head drop parse-inches
504 "%s precipitation in last 6 hours" sprintf ;
506 : parse-24hr-precipitation ( str -- str' )
507 "7" ?head drop parse-inches
508 "%s precipitation in last 24 hours" sprintf ;
510 ! XXX: "on the hour" instead of "00 minutes past the hour" ?
512 : parse-recent-time ( str -- str' )
515 [ " minutes past the hour" append ] if ;
517 : parse-peak-wind ( str -- str' )
518 "/" split1 [ parse-wind ] [ parse-recent-time ] bi*
519 "%s occuring at %s" sprintf ;
521 : parse-sea-level-pressure ( str -- str' )
522 "SLP" ?head drop string>number 10.0 /f 1000 +
523 "sea-level pressure is %s hPa" sprintf ;
525 : parse-lightning ( str -- str' )
526 "LTG" ?head drop 2 group [ lightning at ] map join-words ;
528 CONSTANT: re-recent-weather R/ ((\w{2})?[BE]\d{2,4}((\w{2})?[BE]\d{2,4})?)+/
530 : parse-began/ended ( str -- str' )
532 [ CHAR: B = "began" "ended" ? ]
533 [ parse-recent-time ] bi* "%s at %s" sprintf ;
535 : split-recent-weather ( str -- seq )
537 dup [ digit? ] find drop
538 over [ digit? not ] find-from drop
539 [ cut ] [ f ] if* swap
542 : (parse-recent-weather) ( str -- str' )
543 dup [ digit? ] find drop 2 > [
544 2 cut [ weather at " " append ] dip
545 ] [ f swap ] if parse-began/ended "" append-as ;
547 : parse-recent-weather ( str -- str' )
549 [ (parse-recent-weather) ] map join-words ;
551 : parse-varying ( str -- str' )
552 "V" split1 [ string>number ] bi@
553 "varying between %s00 and %s00 ft" sprintf ;
555 : parse-from-to ( str -- str' )
556 "-" split [ parse-glossary ] map " to " join ;
558 : parse-water-equivalent-snow ( str -- str' )
559 "933" ?head drop parse-inches
560 "%s water equivalent of snow on ground" sprintf ;
562 : parse-duration-of-sunshine ( str -- str' )
563 "98" ?head drop string>number
564 [ "no" ] [ "%s minutes of" sprintf ] if-zero
565 "%s sunshine" sprintf ;
567 : parse-6hr-snowfall ( str -- str' )
568 "931" ?head drop parse-inches
569 "%s snowfall in last 6 hours" sprintf ;
571 : parse-probability ( str -- str' )
572 "PROB" ?head drop string>number
573 "probability of %d%%" sprintf ;
575 : parse-remark ( str -- str' )
577 { [ dup glossary key? ] [ glossary at ] }
578 { [ dup R/ 1\d{4}/ matches? ] [ parse-6hr-max-temp ] }
579 { [ dup R/ 2\d{4}/ matches? ] [ parse-6hr-min-temp ] }
580 { [ dup R/ 4\d{8}/ matches? ] [ parse-24hr-temp ] }
581 { [ dup R/ 4\/\d{3}/ matches? ] [ parse-snow-depth ] }
582 { [ dup R/ 5\d{4}/ matches? ] [ parse-1hr-pressure ] }
583 { [ dup R/ 6[\d\/]{4}/ matches? ] [ parse-6hr-precipitation ] }
584 { [ dup R/ 7\d{4}/ matches? ] [ parse-24hr-precipitation ] }
585 { [ dup R/ 8\/\d{3}/ matches? ] [ parse-cloud-cover ] }
586 { [ dup R/ 931\d{3}/ matches? ] [ parse-6hr-snowfall ] }
587 { [ dup R/ 933\d{3}/ matches? ] [ parse-water-equivalent-snow ] }
588 { [ dup R/ 98\d{3}/ matches? ] [ parse-duration-of-sunshine ] }
589 { [ dup R/ T\d{4,8}/ matches? ] [ parse-1hr-temp ] }
590 { [ dup R/ \d{3}\d{2,3}\/\d{2,4}/ matches? ] [ parse-peak-wind ] }
591 { [ dup R/ P\d{4}/ matches? ] [ parse-1hr-precipitation ] }
592 { [ dup R/ SLP\d{3}/ matches? ] [ parse-sea-level-pressure ] }
593 { [ dup R/ LTG\w+/ matches? ] [ parse-lightning ] }
594 { [ dup R/ PROB\d+/ matches? ] [ parse-probability ] }
595 { [ dup R/ \d{3}V\d{3}/ matches? ] [ parse-varying ] }
596 { [ dup R/ [^-]+(-[^-]+)+/ matches? ] [ parse-from-to ] }
597 { [ dup R/ [^\/]+(\/[^\/]+)+/ matches? ] [ ] }
598 { [ dup R/ \d+.\d+/ matches? ] [ ] }
599 { [ dup re-recent-weather matches? ] [ parse-recent-weather ] }
600 { [ dup re-weather matches? ] [ parse-weather ] }
601 { [ dup re-sky-condition matches? ] [ parse-sky-condition ] }
605 : metar-remarks ( report seq -- report )
606 [ parse-remark ] map join-words >>remarks ;
608 : <metar-report> ( metar -- report )
609 [ metar-report new ] dip [ >>raw ] keep
610 [ blank? ] split-when { "RMK" } split1
611 [ metar-body ] [ metar-remarks ] bi* ;
613 : row. ( name quot -- )
615 [ _ write ] with-cell
616 [ @ [ 65 wrap-string write ] when* ] with-cell
619 : metar-report. ( report -- )
620 standard-table-style [
622 [ "Station" [ station>> ] row. ]
623 [ "Timestamp" [ timestamp>> ] row. ]
624 [ "Wind" [ wind>> ] row. ]
625 [ "Visibility" [ visibility>> ] row. ]
626 [ "RVR" [ rvr>> ] row. ]
627 [ "Weather" [ weather>> ] row. ]
628 [ "Sky condition" [ sky-condition>> ] row. ]
629 [ "Temperature" [ temperature>> ] row. ]
630 [ "Dew point" [ dew-point>> ] row. ]
631 [ "Altimeter" [ altimeter>> ] row. ]
632 [ "Remarks" [ remarks>> ] row. ]
633 [ "Raw Text" [ raw>> ] row. ]
635 ] tabular-output nl ;
639 GENERIC: metar ( station -- metar )
641 M: station metar cccc>> metar ;
644 "http://tgftp.nws.noaa.gov/data/observations/metar/stations/%s.TXT"
645 sprintf http-get nip ;
647 GENERIC: metar. ( station -- )
649 M: station metar. cccc>> metar. ;
652 [ metar <metar-report> metar-report. ]
653 [ drop "%s METAR not found\n" printf ] recover ;
657 : parse-wind-shear ( str -- str' )
658 "WS" ?head drop "/" split1
659 [ parse-altitude ] [ parse-wind ] bi* prepend
660 "wind shear " prepend ;
662 CONSTANT: re-from-timestamp R/ FM\d{6}/
664 : parse-from-timestamp ( str -- str' )
665 "FM" ?head drop parse-timestamp ;
667 CONSTANT: re-valid-timestamp R/ \d{4}\/\d{4}/
669 : parse-valid-timestamp ( str -- str' )
670 "/" split1 [ "00" append parse-timestamp ] bi@ " to " glue ;
672 TUPLE: taf-report station timestamp valid-timestamp wind
673 visibility rvr weather sky-condition partials raw ;
675 TUPLE: taf-partial from-timestamp wind visibility rvr weather
678 : taf-body ( report str -- report )
679 [ blank? ] split-when
681 [ "TAF" = ] find-one drop
683 [ { "AMD" "COR" "RTD" } member? ] find-one drop
685 [ re-station matches? ] find-one
686 [ pick station<< ] when*
688 [ re-timestamp matches? ] find-one
689 [ parse-timestamp pick timestamp<< ] when*
691 [ re-valid-timestamp matches? ] find-one
692 [ parse-valid-timestamp pick valid-timestamp<< ] when*
694 [ re-wind matches? ] find-one
695 [ parse-wind pick wind<< ] when*
697 [ re-wind-variable matches? ] find-one
698 [ parse-wind-variable pick wind>> prepend pick wind<< ] when*
700 [ re-visibility matches? ] find-one
701 [ parse-visibility pick visibility<< ] when*
703 [ re-rvr matches? ] find-all join-words
704 [ parse-rvr ] map ", " join pick rvr<<
706 [ re-weather matches? ] find-all
707 [ parse-weather ] map ", " join pick weather<<
709 [ re-sky-condition matches? ] find-all
710 [ parse-sky-condition ] map ", " join pick sky-condition<<
714 : <taf-partial> ( str -- partial )
715 [ taf-partial new ] dip [ blank? ] split-when
717 [ re-from-timestamp matches? ] find-one
718 [ parse-from-timestamp pick from-timestamp<< ] when*
720 [ re-wind matches? ] find-one
721 [ parse-wind pick wind<< ] when*
723 [ re-wind-variable matches? ] find-one
724 [ parse-wind-variable pick wind>> prepend pick wind<< ] when*
726 [ re-visibility matches? ] find-one
727 [ parse-visibility pick visibility<< ] when*
729 [ re-rvr matches? ] find-all join-words
730 [ parse-rvr ] map ", " join pick rvr<<
732 [ re-weather matches? ] find-all
733 [ parse-weather ] map ", " join pick weather<<
735 [ re-sky-condition matches? ] find-all
736 [ parse-sky-condition ] map ", " join pick sky-condition<<
740 : taf-partials ( report seq -- report )
741 [ <taf-partial> ] map >>partials ;
743 : <taf-report> ( taf -- report )
744 [ taf-report new ] dip [ >>raw ] keep
745 split-lines [ [ blank? ] trim ] map
746 rest dup first "TAF" = [ rest ] when
747 harvest unclip swapd taf-body swap taf-partials ;
749 : taf-report. ( report -- )
751 standard-table-style [
753 [ "Station" [ station>> ] row. ]
754 [ "Timestamp" [ timestamp>> ] row. ]
755 [ "Valid From" [ valid-timestamp>> ] row. ]
756 [ "Wind" [ wind>> ] row. ]
757 [ "Visibility" [ visibility>> ] row. ]
758 [ "RVR" [ rvr>> ] row. ]
759 [ "Weather" [ weather>> ] row. ]
760 [ "Sky condition" [ sky-condition>> ] row. ]
761 [ "Raw Text" [ raw>> ] row. ]
766 standard-table-style [
768 [ "From" [ from-timestamp>> ] row. ]
769 [ "Wind" [ wind>> ] row. ]
770 [ "Visibility" [ visibility>> ] row. ]
771 [ "RVR" [ rvr>> ] row. ]
772 [ "Weather" [ weather>> ] row. ]
773 [ "Sky condition" [ sky-condition>> ] row. ]
781 GENERIC: taf ( station -- taf )
783 M: station taf cccc>> taf ;
786 "http://tgftp.nws.noaa.gov/data/forecasts/taf/stations/%s.TXT"
787 sprintf http-get nip ;
789 GENERIC: taf. ( station -- )
791 M: station taf. cccc>> taf. ;
794 [ taf <taf-report> taf-report. ]
795 [ drop "%s TAF not found\n" printf ] recover ;
799 [ metar print ] [ taf print ] bi nl