Weather METARs

Screenshots, descriptions and links to applications compiled with LB Booster, to illustrate how it is being used
User avatar
JackKelly
Posts: 63
Joined: Fri Apr 06, 2018 2:38 am
Location: Rome NY, USA

Weather METARs

Post by JackKelly »


Every hour or so, hundreds of weather stations throughout the world, mostly at airports, send data to a public server run by NOAA, an agency of the US government. Most of the stations are at least partially automated. Anyone can then access the current data from a station but the coding is bewildering. This program decodes the most commonly used codes and reports them in an understandable way.

Updated 11/9/23 for vertical visibility

Code: Select all

' Airport Weather Information, 11/11/23
Version$="1.1.2"
NoMainWin
WindowWidth = 1200: WindowHeight = 600
BackgroundColor$ = "191 191 255"
Today$=date$("mm/dd/yyyy")
TodaysDate$=mid$(Today$,4,2)
Tomorrow=date$("days")+1
Tomorrow$=date$(Tomorrow)
TomorrowsDate$=mid$(Tomorrow$,4,2)

Statictext #1.Debug "", 0, 0, 500, 30
Textbox #1.AirportCode 50, 50, 200, 30
Statictext #1.Text "", 70, 85, 200, 30
TextEditor #1.Display 50, 150, 1100, 400
Button #1.Default "Enter", [ProcessAirport], UL, 280, 45, 70, 40
Button #1.Quit "Quit", Quit, UL, 380, 45, 70, 40
Statictext #1.Version "v. " + Version$, 1110, 552, 100, 15
open "AIRPORT WEATHER IFORMATION (USA & Canada Only)" for dialog as #1
#1 "Font ariel 14"
#1.Version "!Font ariel 10"
#1 "TrapClose Quit"


[Top]
'Airport$="KMGJ"
'Airport$="TEST"

TestMETAR$="TEST 310325Z COR 05012G18KT 300V100 M1 3/4SM R30L/5000VP6000FT -SN XYFG VV007 M24/M30 A2993" 'maximum
'TestMETAR$="KRME 060953Z AUTO 00000KT 10SM OVC080 02/M01 A3019" 'normal
'TestMETAR$="PANC 090553Z 00000KT 1/2SM R07R/4500VP6000FT SN FG VV007 01/00 A2882" ' vertical visibility
'TestMETAR$="CYYZ 112100Z 14004KT 360V170 15SM FEW030 OVC038 03/M02 A3043" 'north wind direction

if Airport$="" then
        #1.Text " Enter Airport Code"
    else
        #1.AirportCode Airport$
        goto [ProcessAirport]
end if
#1.AirportCode "!SetFocus"
#1.AirportCode "!SelectAll"
wait

[ProcessAirport]
TestRun=0
#1.Display "!cls"
#1.AirportCode "!Contents? AirportCode$"
AirportCode$=upper$(AirportCode$)
z$=""
for x=1 to len(AirportCode$)
    y$=mid$(AirportCode$, x, 1)
    if y$=>"A" and y$=<"Z" then z$=z$+y$
next x
AirportCode$=left$(z$,4)
if AirportCode$="TEST" then
    if TestMETAR$<>"" then Metar$=TestMETAR$: TestRun=1: goto [TestEntry] else goto [Top]
end if
if len(AirportCode$)=3 then AirportCode$="K"+AirportCode$
if len(AirportCode$)<3 then goto [Top]
CD$=left$(AirportCode$, 1) 'Weather Station Area Designator
if CD$<>"K" and CD$<>"C" and CD$<>"P" and CD$<>"T" then goto [Top]
#1.AirportCode AirportCode$

URL$="http://tgftp.nws.noaa.gov/data/observations/metar/stations/"+AirportCode$+".TXT"
FileName$="METAR.txt"
ReturnCode=DownloadToFile(URL$, FileName$)
if  ReturnCode<>0 then #1.Display "No METAR for Airport Code "; AirportCode$: goto [Bottom]
open FileName$ for input as #f
line input #f METAR$
close #f
MetarStart=instr(METAR$, AirportCode$)
MetarEnd=instr(METAR$, " RMK ")
Metar$=mid$(METAR$, MetarStart, MetarEnd-MetarStart)
#1.Display date$("mmmm d, yyyy"); " at "; left$(time$("hh:mm"), 5)

struct SYSTEMTIME,_
Year as short, Month as short,_
DayOfWeek as short, Day as short,_
Hour as short, Minute as short, Second as short,_
Milliseconds as short

CallDLL #kernel32, "GetSystemTime",_
SYSTEMTIME as struct,_
ret as void
UTC.hour=SYSTEMTIME.Hour.struct
UTC.min=SYSTEMTIME.Minute.struct
UTC$=AddLeadingZeros$(UTC.hour, 2) + AddLeadingZeros$(UTC.min, 2)

[TestEntry]
MetarDate$=mid$(Metar$, 6, 2)
MetarTime$=mid$(Metar$, 8, 4)
#1.Display Metar$
#1.Display ""
#1.Display "Weather Information for "; AirportCode$; ", "; MetarDate$; " at "; MetarTime$; " zulu ";

[Wind]
MetarWordNumber=3
MetarWord$=word$(Metar$, MetarWordNumber)
if MetarWord$="AUTO" then
    #1.Display "(automated reporting)"
    MetarWordNumber+=1
    MetarWord$=word$(Metar$, MetarWordNumber)
else
    if MetarWord$="COR" then
        #1.Display "(corrected)"
        MetarWordNumber+=1
        MetarWord$=word$(Metar$, MetarWordNumber)
    else
        #1.Display ""
    end if
end if
if not(TestRun) then
    if MetarDate$<>TodaysDate$ and MetarDate$<>TomorrowsDate$ then
        #1.Display "*** WARNING - METAR not current ***"
    end if
    TD$=TimeDifference$(UTC$, MetarTime$)
    if val(TD$)<2 then TD$="2"
    #1.Display "     ["; TD$; " minutes ago]"
else
    #1.Display "*** TEST DATA ONLY ***"
end if

WW1$=MetarWord$ 'Metar Wind Word #1
WindSpeed$=mid$(WW1$, 4, 2)
WindDirection$=left$(WW1$, 3): WindDir=val(WindDirection$)
if WindSpeed$="00" then #1.Display "Wind calm": goto [Visibility]
WW2$=word$(Metar$, MetarWordNumber+1)
if mid$(WW2$, 4, 1)="V" then 'variable wind direction
    FromDir=val(left$(WW2$, 3)): ToDir=val(right$(WW2$, 3))
    #1.Display "Wind variable from "; FromDir; " to "; ToDir; " degrees ";
    if FromDir=360 then FromDir=000
    if FromDir>ToDir then ToDir+=360
    if WindDir<FromDir then WindDir+=360
    if WindDir>FromDir and WindDir<ToDir then
        #1.Display "(median "; WindDirection$; ") ";
    end if
    x=instr(Metar$, WW2$)
    Metar$="T "+right$(Metar$, len(Metar$)-x-len(WW2$))
    goto [WindSpeed]
end if
if WindDirection$="VRB" then
    #1.Display "Wind variable ";
else
    #1.Display "Wind from "; WindDirection$; " degrees (true) ";
end if

[WindSpeed]
#1.Display "at "; WindSpeed$; " knots";
Gusting=instr(WW1$,"G")
if Gusting then
    Gusting$=mid$(WW1$,Gusting+1, 2)
    #1.Display ", gusting to "; Gusting$;
end if
#1.Display ""

[Visibility]
MetarVisibilityPosEnd=instr(Metar$, "SM ")-1
MetarVisibilityPos=MetarVisibilityPosEnd
Visibility$="": x$=""
do until x$="T"
    x$=mid$(Metar$, MetarVisibilityPos, 1)
    Visibility$=x$+Visibility$
    MetarVisibilityPos-=1
loop
Visibility$=right$(Visibility$, len(Visibility$)-2)
if left$(Visibility$,1)="M" then Visibility$="Less than " + right$(Visibility$, len(Visibility$)-1)
#1.Display Visibility$; " mile visibility (statute miles)"

[GroundConditions]
MetarSkyPos=instr(Metar$, "SM ")+3
SkyCondition$=right$(Metar$, len(Metar$)-MetarSkyPos+1)
for x=1 to 10
    y$=word$(SkyCondition$,x)
    if x=1 and left$(y$,1)="R" and instr(y$,"/")>0 and right$(y$,2)="FT" then
        Runway$=mid$(y$, 2, instr(y$,"/")-2)
        #1.Display "*** WARNING - Reduced visibility on runway "; Runway$; " ***   ["; y$; "]"
        goto [BumpFOR]
    end if
    CC$=left$(y$,2) 'Cloud Condition Code
    if CC$="CL" or CC$="SK" or CC$="FE" or CC$="SC" or CC$="BK" or CC$="OV" or CC$="VV" then
        FirstCC=x: exit for    
    end if
    select case y$
        case   "-DZ": #1.Display "light drizzle"
        case    "DZ": #1.Display "drizzle"
        case   "+DZ": #1.Display "heavy drizzle"
        case   "-RA": #1.Display "light rain"
        case    "RA": #1.Display "rain"
        case   "+RA": #1.Display "heavy rain"
        case "-SHRA": #1.Display "light rainshowers"
        case  "SHRA": #1.Display "rainshowers"
        case "+SHRA": #1.Display "heavy rainshowers"
        case "-FZRA": #1.Display "light freezing rain"
        case  "FZRA": #1.Display "freezing rain"
        case "+FZRA": #1.Display "heavy freezing rain"
        case   "-SN": #1.Display "light snow"
        case    "SN": #1.Display "snow"
        case   "+SN": #1.Display "heavy snow"
        case  "DRSN": #1.Display "drifting snow"
        case    "GR": #1.Display "hail"
        case    "GS": #1.Display "sleet"
        case    "UP": #1.Display "precipitation"
        case "-FZFG": #1.Display "light freezing fog"
        case  "FZFG": #1.Display "freezing fog"
        case "+FZFG": #1.Display "heavy freezing fog"
        case    "FG": #1.Display "fog"
        case  "BCFG": #1.Display "patches of fog"
        case    "BR": #1.Display "mist"
        case    "FU": #1.Display "smoke"
        case    "HZ": #1.Display "haze"
        case    "SQ": #1.Display "squalls"
        case    "TS": #1.Display "thunderstorm"
        case    "FC": #1.Display "funnel cloud"
        case    "VA": #1.Display "volcanic ash"
        case else   : #1.Display y$
    end select
[BumpFOR]
next x

dim SkyCondition$(10): x=1: y=FirstCC
[Loop1]
    SkyCondition$(x)=word$(SkyCondition$, y)
    if instr(word$(SkyCondition$, y), "/")=0 then
        x+=1: y+=1: goto [Loop1]
    end if
TemperatureDewpoint$=SkyCondition$(x) 'save for later

[SkyConditions]
MinBroken=99999: MinOvercast=99999
#1.Display "Cloud Conditions: "; 
for y=1 to x-1
'#1.Debug SkyCondition$(y);wait
    Clouds$=left$(SkyCondition$(y), 2)
    Altitude=val(right$(SkyCondition$(y),3))*100
    Altitude$=trim$(using("##,### feet", Altitude))
    select case Clouds$
        case "CL": #1.Display "clear";
        case "SK": #1.Display "clear";
        case "FE": #1.Display "a few at "; Altitude$;
        case "SC": #1.Display "scattered at "; Altitude$;
        case "BK": #1.Display "broken at "; Altitude$;
            MinBroken=min(Altitude, MinBroken)
        case "OV": #1.Display "overcast at "; Altitude$;
            MinOvercast=min(Altitude, MinOvercast)
        case "VV" : #1.Display "vertical visibility "; Altitude$;
            MinOvercast=min(Altitude, MinOvercast)
    end select
    if y=1 and Altitude<10000 and Altitude<>0 then #1.Display " (agl)";
    if y<x-1 then #1.Display ", ";
next y
#1.Display ""

Ceiling=min(MinBroken, MinOvercast)
MaxReportedCeiling=10000
if Ceiling<MaxReportedCeiling then #1.Display "     [Ceiling is "; trim$(using("##,### feet", Ceiling)); "]"

[Temperature] 'TemperatureDewpoint$=SkyCondition$(x)    
Dewpoint$=mid$(TemperatureDewpoint$, instr(TemperatureDewpoint$, "/")+1)
Temperature$=left$(TemperatureDewpoint$, len(TemperatureDewpoint$)-len(Dewpoint$)-1)
if right$(Dewpoint$,2)="00" then Dewpoint$="zero"
if left$(Dewpoint$,1)="M" then left$(Dewpoint$,1)="-"
if right$(Temperature$,2)="00" then Temperature$="zero"
if left$(Temperature$,1)="M" then left$(Temperature$,1)="-"
#1.Display "Temperature "; Temperature$; " (celsius), dewpoint "; Dewpoint$
#1.Display "     ["; trim$(using("+###", (val(Temperature$)*9/5+32))); " farenheit]"

[Pressure]
Pressure$=right$(Metar$, 5)
#1.Display "Altimeter "; right$(Pressure$, 4);
if left$(Pressure$, 1)="A" then #1.Display  " (in. hg)"
if left$(Pressure$, 1)="Q" then #1.Display  " (mm. hg)"

[Bottom]
#1.Display "!Origin 0 0"
#1.AirportCode "!SetFocus"
#1.AirportCode "!SelectAll"
wait

sub Quit
    close #1
    end
end sub
 
function DownloadToFile(urlfile$, localfile$)
    open "URLmon" for dll as #url
        calldll #url, "URLDownloadToFileA",_
        0 as long,_         'null
        urlfile$ as ptr,_   'url to download
        localfile$ as ptr,_ 'save file name
        0 as long,_         'reserved, must be 0
        0 as long,_         'callback address, can be 0
        DownloadToFile as ulong  '0=success
    close #url
end function

function TimeDifference$(Time1$, Time2$)
    Hour1$=left$(Time1$,2): Hour1=val(Hour1$)
    Min1$= right$(Time1$,2): Min1=val(Min1$)
    Hour2$=left$(Time2$,2): Hour2=val(Hour2$)
    Min2$= right$(Time2$,2): Min2=val(Min2$)
    if Hour1<Hour2 then Hour1+=24
    if Min1<Min2 then Hour1-=1: Min1+=60

    HourDiff=Hour1-Hour2: MinDiff=Min1-Min2
    TotalDiff=(HourDiff*60)+MinDiff

    TimeDifference$=str$(TotalDiff)
end function

function AddLeadingZeros$(Number, Length)
    AddLeadingZeros$=str$(Number)
    ZerosNeeded=Length-len(AddLeadingZeros$)
    for x=1 to ZerosNeeded
        AddLeadingZeros$="0"+AddLeadingZeros$
    next x
end function
JackKellyUSA
Posts: 3
Joined: Sat Jun 08, 2024 3:42 pm

Re: Weather METARs

Post by JackKellyUSA »

What do you think is happening here? This thread has been viewed nearly 10,000 times this year. How is that possible in a forum with only 92 members? Are there thousands of LBB users out there that we don't know about? Perhaps aviation enthusiasts Google "METARs" and investigate a hit on this thread? Is that possible? If so, I hope some of them download the compiler and run the program... LOL.
JackKellyUSA
Posts: 3
Joined: Sat Jun 08, 2024 3:42 pm

Re: Weather METARs

Post by JackKellyUSA »

That is EXACTLY what is happening here. Aviation weather enthusiasts, use this link to download the compiler and use it to view the METAR program.

https://lbbooster.com/LBB.exe

Email me if you have any questions, problems, or comments...

9733626814@charter.net
xxgeek
Posts: 13
Joined: Tue Nov 28, 2023 1:36 pm

Re: Weather METARs

Post by xxgeek »

Hi Jack,
Nice work.
Will come in handy for travelers I'm sure.

Hope you don't mind, I've added a Listbox with Canadian, American, and International Airports to choose from.
You can still enter a code into the textbox and hit {Enter] if you know a code......... or select an airport from the List.

Also added some extra text to the display to show the name for the chosen airport, or entered code.

There are more possible airports around the world, I have only added International, Canadian (Regional), and American (Regional)
As you will see, some airports do not have METAR info, just the more major ones.
Link - https://drive.proton.me/urls/DYEG4W0QJR#ObpNbjLWGLmj
2 files zipped
1 x .bas file
1 x .txt file
JackKellyUSA
Posts: 3
Joined: Sat Jun 08, 2024 3:42 pm

Re: Weather METARs

Post by JackKellyUSA »

Here's the latest version of the program -- 2.1.1 (dated 23June2024). A few bugs have been fixed and it works much the same unless you have the airport file. Use this link to download it, then put it in the same folder as the program.

https://mega.nz/file/TctDHKBZ#TdIsjD_3V ... E_zTvmKtw

Now it will work similar to xxgeek's version, which inspired me to get busy again. LOL.

Code: Select all

' Airport Weather Information, 06/23/24
Version$="2.1.1"
NoMainWin
WindowWidth = 1200: WindowHeight = 600
BackgroundColor$ = "191 191 255"
Today$=date$("mm/dd/yyyy")
TodaysDate$=mid$(Today$,4,2)
Tomorrow=date$("days")+1
Tomorrow$=date$(Tomorrow)
TomorrowsDate$=mid$(Tomorrow$,4,2)

Statictext #1.Debug "", 0, 0, 700, 30
Textbox #1.AirportCode 50, 50, 200, 30
Statictext #1.Text "", 70, 85, 200, 30
TextEditor #1.Display 50, 120, 1100, 430
Button #1.Default "Enter", [ProcessAirport], UL, 280, 45, 70, 40
Button #1.Quit "Quit", Quit, UL, 380, 45, 70, 40
ComboBox #1.ComboBox ComboBoxArray$(), [ComboBoxClick], 500, 50, 600, 0
Statictext #1.Version "v. " + Version$, 1110, 552, 100, 15
open "AIRPORT WEATHER IFORMATION (USA & Canada Only)" for dialog as #1
#1 "Font ariel 14"
#1.Version "!Font ariel 10 bold"
#1.ComboBox "Hide"
#1 "TrapClose Quit"

[Top]
'Airport$="KMGJ"
'Airport$="TEST"

TestMETAR$="TEST 310325Z COR 05012G18KT 300V100 M1 3/4SM R30L/5000VP6000FT -SN XYFG VV007 M24/M30 A2993" 'maximum
'TestMETAR$="KRME 060953Z AUTO 00000KT 10SM OVC080 02/M01 A3019" 'normal
'TestMETAR$="PANC 090553Z 00000KT 1/2SM R07R/4500VP6000FT SN FG VV007 01/00 A2882" ' vertical visibility
'TestMETAR$="CYYZ 112100Z 14004KT 360V170 15SM FEW030 OVC038 03/M02 A3043" 'north wind direction

if exists("US & Canada Airports.txt") then
    dim Airports$(500,1)
    open "US & Canada Airports.txt" for input as #2
    line input #2, x$
    while not(eof(#2))
        line input #2, x$
        Count += 1
        Airports$(Count,0) = right$(x$, 4)
        Airports$(Count,1) = left$(x$, len(x$)-7)
    wend
    close #2
    Airports$(0,0) = "Count": Airports$(0,1) = str$(Count)
    sort Airports$(), 1, Count, 1
    dim ComboBoxArray$(500)
    for x=1 to Count
        ComboBoxArray$(x)=Airports$(x,1)
    next x
    #1.ComboBox "Show"
    #1.ComboBox "Reload"
    #1.ComboBox "!Airport List ("+str$(Count)+")"
    AirportFile=1
end if

if Airport$="" then
        #1.Text " Enter Airport Code"
    else
        #1.AirportCode Airport$
        goto [ProcessAirport]
end if
#1.AirportCode "!SetFocus"
#1.AirportCode "!SelectAll"
wait

[ProcessAirport]
TestRun=0
#1.Display "!cls"
#1.AirportCode "!Contents? AirportCode$"
if AirportCode$="" then wait
AirportCode$=upper$(AirportCode$)
z$=""
for x=1 to len(AirportCode$)
    y$=mid$(AirportCode$, x, 1)
    if y$=>"A" and y$=<"Z" then z$=z$+y$
next x
AirportCode$=left$(z$,4)
if AirportCode$="TEST" then
    if TestMETAR$<>"" then Metar$=TestMETAR$: TestRun=1: goto [TestEntry] else goto [Top]
end if
if len(AirportCode$)=3 then AirportCode$="K"+AirportCode$
if len(AirportCode$)<3 then goto [Top]
CD$=left$(AirportCode$, 1) 'Weather Station Area Designator
if CD$<>"K" and CD$<>"C" and CD$<>"P" and CD$<>"T" then goto [Top]
#1.AirportCode AirportCode$
AirportName$=AirportCode$
if AirportFile then AirportName$ = AirportName$(AirportCode$)

URL$="http://tgftp.nws.noaa.gov/data/observations/metar/stations/"+AirportCode$+".TXT"
FileName$="METAR.txt"
ReturnCode=DownloadToFile(URL$, FileName$)
if  ReturnCode<>0 then #1.Display "No METAR for "; AirportName$: goto [Bottom]
open FileName$ for input as #f
line input #f METAR$
close #f
MetarStart=instr(METAR$, AirportCode$)
MetarEnd=instr(METAR$, " RMK ")
Metar$=trim$(mid$(METAR$, MetarStart, MetarEnd-MetarStart))
#1.Display date$("mmmm d, yyyy"); " at "; left$(time$("hh:mm"), 5)

struct SYSTEMTIME,_
Year as short, Month as short,_
DayOfWeek as short, Day as short,_
Hour as short, Minute as short, Second as short,_
Milliseconds as short

CallDLL #kernel32, "GetSystemTime",_
SYSTEMTIME as struct,_
ret as void
UTC.hour=SYSTEMTIME.Hour.struct
UTC.min=SYSTEMTIME.Minute.struct
UTC$=AddLeadingZeros$(UTC.hour, 2) + AddLeadingZeros$(UTC.min, 2)

[TestEntry]
MetarDate$=mid$(Metar$, 6, 2)
MetarTime$=mid$(Metar$, 8, 4)
#1.Display Metar$
#1.Display ""
#1.Display "Weather Information for "; AirportName$
#1.Display "Day "; MetarDate$; " at "; MetarTime$; " zulu ";

[Wind]
MetarWordNumber=3
MetarWord$=word$(Metar$, MetarWordNumber)
if MetarWord$="AUTO" then
    #1.Display "(automated reporting)"
    MetarWordNumber+=1
    MetarWord$=word$(Metar$, MetarWordNumber)
else
    if MetarWord$="COR" then
        #1.Display "(corrected)"
        MetarWordNumber+=1
        MetarWord$=word$(Metar$, MetarWordNumber)
    else
        #1.Display ""
    end if
end if
METARcurrent=1
if not(TestRun) then
    if MetarDate$<>TodaysDate$ and MetarDate$<>TomorrowsDate$ then
        METARcurrent=0
        #1.Display "*** WARNING - METAR not current ***"
    end if
    TD$=TimeDifference$(UTC$, MetarTime$)
    if val(TD$)<2 then TD$="2"
    if METARcurrent then #1.Display "     ["; TD$; " minutes ago]"
else
    #1.Display "*** TEST DATA ONLY ***"
end if

WW1$=MetarWord$ 'Metar Wind Word #1
WindSpeed$=mid$(WW1$, 4, 2)
WindDirection$=left$(WW1$, 3): WindDir=val(WindDirection$)
if WindSpeed$="00" then #1.Display "Wind calm": goto [Visibility]
WW2$=word$(Metar$, MetarWordNumber+1)
if mid$(WW2$, 4, 1)="V" then 'variable wind direction
    FromDir=val(left$(WW2$, 3)): ToDir=val(right$(WW2$, 3))
    #1.Display "Wind variable from "; FromDir; " to "; ToDir; " degrees ";
    if FromDir=360 then FromDir=000
    if FromDir>ToDir then ToDir+=360
    if WindDir<FromDir then WindDir+=360
    if WindDir>FromDir and WindDir<ToDir then
        #1.Display "(median "; WindDirection$; ") ";
    end if
    x=instr(Metar$, WW2$)
    Metar$="T "+right$(Metar$, len(Metar$)-x-len(WW2$))
    goto [WindSpeed]
end if
if WindDirection$="VRB" then
    #1.Display "Wind variable ";
else
    #1.Display "Wind from "; WindDirection$; " degrees (true) ";
end if

[WindSpeed]
#1.Display "at "; WindSpeed$; " knots";
Gusting=instr(WW1$,"G")
if Gusting then
    Gusting$=mid$(WW1$,Gusting+1, 2)
    #1.Display ", gusting to "; Gusting$;
end if
#1.Display ""

[Visibility]
if not(instr(Metar$, "SM ")) then
    #1.Display "No visibility - report terminated"
    goto [Bottom] 
end if
MetarVisibilityPosEnd=instr(Metar$, "SM ")-1
MetarVisibilityPos=MetarVisibilityPosEnd
Visibility$="": x$=""
do until x$="T"
    x$=mid$(Metar$, MetarVisibilityPos, 1)
    Visibility$=x$+Visibility$
    MetarVisibilityPos-=1
loop
Visibility$=right$(Visibility$, len(Visibility$)-2)
if left$(Visibility$,1)="M" then Visibility$="Less than " + right$(Visibility$, len(Visibility$)-1)
#1.Display Visibility$; " mile visibility (statute miles)"

[GroundConditions]
MetarSkyPos=instr(Metar$, "SM ")+3
SkyCondition$=right$(Metar$, len(Metar$)-MetarSkyPos+1)
for x=1 to 10
    y$=word$(SkyCondition$,x)
    if x=1 and left$(y$,1)="R" and instr(y$,"/")>0 and right$(y$,2)="FT" then
        Runway$=mid$(y$, 2, instr(y$,"/")-2)
        #1.Display "*** WARNING - Reduced visibility on runway "; Runway$; " ***   ["; y$; "]"
        goto [BumpFOR]
    end if
    CC$=left$(y$,2) 'Cloud Condition Code
    if CC$="CL" or CC$="SK" or CC$="FE" or CC$="SC" or CC$="BK" or CC$="OV" or CC$="VV" then
        FirstCC=x: exit for    
    end if
    select case y$
        case   "-DZ": #1.Display "light drizzle"
        case    "DZ": #1.Display "drizzle"
        case   "+DZ": #1.Display "heavy drizzle"
        case   "-RA": #1.Display "light rain"
        case    "RA": #1.Display "rain"
        case   "+RA": #1.Display "heavy rain"
        case "-SHRA": #1.Display "light rainshowers"
        case  "SHRA": #1.Display "rainshowers"
        case "+SHRA": #1.Display "heavy rainshowers"
        case "-FZRA": #1.Display "light freezing rain"
        case  "FZRA": #1.Display "freezing rain"
        case "+FZRA": #1.Display "heavy freezing rain"
        case   "-SN": #1.Display "light snow"
        case    "SN": #1.Display "snow"
        case   "+SN": #1.Display "heavy snow"
        case  "DRSN": #1.Display "drifting snow"
        case    "GR": #1.Display "hail"
        case    "GS": #1.Display "sleet"
        case    "UP": #1.Display "precipitation"
        case "-FZFG": #1.Display "light freezing fog"
        case  "FZFG": #1.Display "freezing fog"
        case "+FZFG": #1.Display "heavy freezing fog"
        case    "FG": #1.Display "fog"
        case  "BCFG": #1.Display "patches of fog"
        case    "BR": #1.Display "mist"
        case    "FU": #1.Display "smoke"
        case    "HZ": #1.Display "haze"
        case    "SQ": #1.Display "squalls"
        case    "TS": #1.Display "thunderstorm"
        case  "TSRA": #1.Display "thunderstorm & rain"
        case  "-TSRA": #1.Display "thunderstorm & rain"
        case    "FC": #1.Display "funnel cloud"
        case    "VA": #1.Display "volcanic ash"
        case else   : #1.Display y$
    end select
[BumpFOR]
next x

[SkyConditions]
dim SkyCondition$(10): x=1: y=FirstCC
[Loop1]
    SkyCondition$(x)=word$(SkyCondition$, y)
    if instr(word$(SkyCondition$, y), "/")=0 then
        x+=1: y+=1: goto [Loop1]
    end if
TemperatureDewpoint$=SkyCondition$(x) 'save for later

MinBroken=99999: MinOvercast=99999
#1.Display "Cloud Conditions: "; 
for y=1 to x-1
'#1.Debug SkyCondition$(y);wait
    Clouds$=left$(SkyCondition$(y), 2)
    Altitude=val(mid$(SkyCondition$(y), 4, 3))*100           'right$(SkyCondition$(y),3))*100
    Altitude$=trim$(using("##,### feet", Altitude))
    select case Clouds$
        case "CL": #1.Display "clear";
        case "SK": #1.Display "clear";
        case "FE": #1.Display "a few at "; Altitude$;
        case "SC": #1.Display "scattered at "; Altitude$;
        case "BK": #1.Display "broken at "; Altitude$;
            MinBroken=min(Altitude, MinBroken)
        case "OV": #1.Display "overcast at "; Altitude$;
            MinOvercast=min(Altitude, MinOvercast)
        case "VV" : #1.Display "vertical visibility "; Altitude$;
            MinOvercast=min(Altitude, MinOvercast)
    end select
    if y=1 and Altitude<10000 and Altitude<>0 then #1.Display " (agl)";
    if y<x-1 then #1.Display ", ";
next y
#1.Display ""

Ceiling=min(MinBroken, MinOvercast)
MaxReportedCeiling=10000
if Ceiling<MaxReportedCeiling then #1.Display "     [Ceiling is "; trim$(using("##,### feet", Ceiling)); "]"

[Temperature] 'TemperatureDewpoint$=SkyCondition$(x)    
Dewpoint$=mid$(TemperatureDewpoint$, instr(TemperatureDewpoint$, "/")+1)
Temperature$=left$(TemperatureDewpoint$, len(TemperatureDewpoint$)-len(Dewpoint$)-1)
if right$(Dewpoint$,2)="00" then Dewpoint$="zero"
if left$(Dewpoint$,1)="M" then left$(Dewpoint$,1)="-"
if right$(Temperature$,2)="00" then Temperature$="zero"
if left$(Temperature$,1)="M" then left$(Temperature$,1)="-"
#1.Display "Temperature "; Temperature$; " (celsius), dewpoint "; Dewpoint$
#1.Display "     ["; trim$(using("+###", (val(Temperature$)*9/5+32))); " farenheit]"

[Pressure]
Pressure$=right$(Metar$, 5)
#1.Display "Altimeter "; right$(Pressure$, 4);
if left$(Pressure$, 1)="A" then #1.Display  " (in. hg)"
if left$(Pressure$, 1)="Q" then #1.Display  " (mm. hg)"

[Bottom]
#1.Display "!Origin 0 0"
#1.AirportCode "!SetFocus"
#1.AirportCode "!SelectAll"
wait

[ComboBoxClick]
    #1.ComboBox "SelectionIndex? SelIndex"
    #1.ComboBox "Selection? Sel$"
    Airport$ = Airports$(SelIndex, 0)
    #1.AirportCode Airport$
    #1.Display "!cls"
wait

function AirportName$(Code$)
    AirportName$=Code$
    for x= 1 to val(Airports$(0,1))
        if Code$ = Airports$(x,0) then
            AirportName$ = Airports$(x,1)
            exit function
        end if
    next x
end function

sub Quit
    close #1
    end
end sub
 
function DownloadToFile(urlfile$, localfile$)
    open "URLmon" for dll as #url
        calldll #url, "URLDownloadToFileA",_
        0 as long,_         'null
        urlfile$ as ptr,_   'url to download
        localfile$ as ptr,_ 'save file name
        0 as long,_         'reserved, must be 0
        0 as long,_         'callback address, can be 0
        DownloadToFile as ulong  '0=success
    close #url
end function

function TimeDifference$(Time1$, Time2$)
    Hour1$=left$(Time1$,2): Hour1=val(Hour1$)
    Min1$= right$(Time1$,2): Min1=val(Min1$)
    Hour2$=left$(Time2$,2): Hour2=val(Hour2$)
    Min2$= right$(Time2$,2): Min2=val(Min2$)
    if Hour1<Hour2 then Hour1+=24
    if Min1<Min2 then Hour1-=1: Min1+=60

    HourDiff=Hour1-Hour2: MinDiff=Min1-Min2
    TotalDiff=(HourDiff*60)+MinDiff

    TimeDifference$=str$(TotalDiff)
end function

function AddLeadingZeros$(Number, Length)
    AddLeadingZeros$=str$(Number)
    ZerosNeeded=Length-len(AddLeadingZeros$)
    for x=1 to ZerosNeeded
        AddLeadingZeros$="0"+AddLeadingZeros$
    next x
end function

function exists(FileName$)
    files "", FileName$, FileDir$()
    FileCount$ = FileDir$(0, 0)
    exists = val(FileCount$)
end function
xxgeek
Posts: 13
Joined: Tue Nov 28, 2023 1:36 pm

Re: Weather METARs

Post by xxgeek »

Hello again Jack,
I noticed it takes a while to load due to a couple of factors.

1. It creates two arrays one after the other using the same info.
(Can be changed to create them in the same loop to save time)
2. It loads a 416 item array into the combobox.
What I have done is used a stylebit (got it from coda) to hide the window until everything is created and loaded.
3. This line is twice in your code, once before the while loop, and once during the loop.
line input #2, x$
_ It was preventing the first Airport in the list from being added to the Combobox.

I also edited the airport list file to include the airport Names, CODE, Province(or State) and the Country
The Name, Province, and Country now appear above the Displayed info as well as in the texteditors display.
Had to change some code to make it work.
I like to see what Airport, and where it is in each country instead of looking up the code.
Just the airports in Canada and the U.S. now.
You can enter a code without using the list if you already know the code.
I hope you like it.

The .bas file

Code: Select all

    'Airport Weather Information, 06/23/24 by Jack Kelly
    ' - Editted by xxgeek (added airport names to Displayed info)
    if exists("US & Canada Airports.txt") then
        NoMainWin
        dim Airports$(500,1)
        dim ComboBoxArray$(500)
        open "US & Canada Airports.txt" for input as #2
        while not(eof(#2))
            line input #2, x$
            Count += 1
            Airports$(Count,0) = word$(x$, 2," - ")
            x$ = word$(x$,1," - ");" (";word$(x$,3," - ");", ";word$(x$,4," - ");")"
            Airports$(Count,1) = x$
            ComboBoxArray$(Count) = Airports$(Count,1)
        wend
        close #2
        Airports$(0,0) = "Count": Airports$(0,1) = str$(Count)
        sort Airports$(), 1, Count*2', 0
        Version$="2.1.1"
        WindowWidth = 1200: WindowHeight = 600
        BackgroundColor$ = "191 191 255"
        Today$=date$("mm/dd/yyyy")
        TodaysDate$=mid$(Today$,4,2)
        Tomorrow=date$("days")+1
        Tomorrow$=date$(Tomorrow)
        TomorrowsDate$=mid$(Tomorrow$,4,2)
        stylebits #1, 0, _WS_VISIBLE, 0, 0                               'set initial state of window to invisible
        Statictext #1.Debug "", 0, 0, 700, 30
        Textbox #1.AirportCode 20, 30, 100, 30
        Statictext #1.name "", 40,115, 1100, 30
        Statictext #1.Text "Airport Code", 20, 65, 200, 30
        TextEditor #1.Display 20, 150, 1160, 400
        Button #1.Default "Enter", [ProcessAirport], UL,130, 25, 70, 40
        Button #1.Quit "Quit", Quit, UL, 210, 25, 70, 40
        ComboBox #1.ComboBox ComboBoxArray$(), [ComboBoxClick], 290, 30, 890, 0
        Statictext #1.Version "v. " + Version$, 1110, 552, 100, 15
        open "AIRPORT WEATHER INFORMATION (USA & Canada Only)" for dialog as #1
        #1 "Font arial 14"
        #1.Version "!Font ariel 10 bold"
        #1.name "!Font arial 18 bold"
        #1 "TrapClose Quit"

[Top]
        'Airport$="KMGJ"
        'Airport$="TEST"

        TestMETAR$="TEST 310325Z COR 05012G18KT 300V100 M1 3/4SM R30L/5000VP6000FT -SN XYFG VV007 M24/M30 A2993" 'maximum
        'TestMETAR$="KRME 060953Z AUTO 00000KT 10SM OVC080 02/M01 A3019" 'normal
        'TestMETAR$="PANC 090553Z 00000KT 1/2SM R07R/4500VP6000FT SN FG VV007 01/00 A2882" ' vertical visibility
        'TestMETAR$="CYYZ 112100Z 14004KT 360V170 15SM FEW030 OVC038 03/M02 A3043" 'north wind direction
        #1.ComboBox "Reload"
        #1.ComboBox "!Select an Airport from this List or Enter an Airport Code           ("+str$(Count-1)+" Airports)                       Click Here  ====>"
        AirportFile=1
       #1.AirportCode Airport$
       #1.AirportCode "!SetFocus"
       #1.AirportCode "!SelectAll"
       #1 "show"
    else
      notice "Program Closing   -   Can't find 'US & Canada Airports.txt"
      end
    end if
 wait

[ProcessAirport]
    TestRun=0
    #1.Display "!cls"

    #1.AirportCode "!Contents? AirportCode$"
    if AirportCode$="" then wait
    AirportCode$=upper$(AirportCode$)
    z$=""
    for x=1 to len(AirportCode$)
        y$=mid$(AirportCode$, x, 1)
        if y$=>"A" and y$=<"Z" then z$=z$+y$
    next x
    AirportCode$=left$(z$,4)
    if AirportCode$="TEST" then
        if TestMETAR$<>"" then Metar$=TestMETAR$: TestRun=1: goto [TestEntry] else goto [Top]
    end if
    if len(AirportCode$)=3 then AirportCode$="K"+AirportCode$
    if len(AirportCode$)<3 then goto [Top]
    CD$=left$(AirportCode$, 1) 'Weather Station Area Designator
    if CD$<>"K" and CD$<>"C" and CD$<>"P" and CD$<>"T" then goto [Top]
    #1.AirportCode AirportCode$
    AirportName$=AirportCode$
    if AirportFile then AirportName$ = AirportName$(AirportCode$)
    if Sel$="" then
        open "US & Canada Airports.txt" for input as #name
        nameOpen = 1
        while eof(#name) =0
            scan
            line input #name, name$
            if instr(name$, " - ";AirportCode$) then
                Sel$ = name$
                #1.AirportCode word$(Sel$,2," - ")
                Sel$=word$(Sel$, 1, "-");" (";word$(Sel$,3," - ");", ";word$(Sel$,4," - ");")"
                close #name
                nameOpen =0
                exit while
            end if
        wend
    end if
    if nameOpen = 1 then close #name
    nameOpen = 0
    #1.name Sel$

    URL$="http://tgftp.nws.noaa.gov/data/observations/metar/stations/"+AirportCode$+".TXT"
    FileName$="METAR.txt"
    ReturnCode=DownloadToFile(URL$, FileName$)
    if  ReturnCode<>0 then #1.Display "No METAR for "; AirportName$: goto [Bottom]
    open FileName$ for input as #f
    line input #f METAR$
    close #f
    MetarStart=instr(METAR$, AirportCode$)
    MetarEnd=instr(METAR$, " RMK ")
    Metar$=trim$(mid$(METAR$, MetarStart, MetarEnd-MetarStart))
    #1.Display date$("mmmm d, yyyy"); " at "; left$(time$("hh:mm"), 5)
    struct SYSTEMTIME,_
        Year as short, Month as short,_
        DayOfWeek as short, Day as short,_
        Hour as short, Minute as short, Second as short,_
        Milliseconds as short

    CallDLL #kernel32, "GetSystemTime",_
        SYSTEMTIME as struct,_
        ret as void
    UTC.hour=SYSTEMTIME.Hour.struct
    UTC.min=SYSTEMTIME.Minute.struct
    UTC$=AddLeadingZeros$(UTC.hour, 2) + AddLeadingZeros$(UTC.min, 2)

[TestEntry]
    MetarDate$=mid$(Metar$, 6, 2)
    MetarTime$=mid$(Metar$, 8, 4)
    #1.Display Metar$
    #1.Display ""
    #1.Display "Weather Information for :"
    #1.Display Sel$
    #1.Display "Day "; MetarDate$; " at "; MetarTime$; " zulu ";

[Wind]
    MetarWordNumber=3
    MetarWord$=word$(Metar$, MetarWordNumber)
    if MetarWord$="AUTO" then
        #1.Display "(automated reporting)"
        MetarWordNumber+=1
        MetarWord$=word$(Metar$, MetarWordNumber)
    else
        if MetarWord$="COR" then
            #1.Display "(corrected)"
            MetarWordNumber+=1
            MetarWord$=word$(Metar$, MetarWordNumber)
        else
            #1.Display ""
        end if
    end if
    METARcurrent=1
    if not(TestRun) then
        if MetarDate$<>TodaysDate$ and MetarDate$<>TomorrowsDate$ then
            METARcurrent=0
            #1.Display "*** WARNING - METAR not current ***"
        end if
        TD$=TimeDifference$(UTC$, MetarTime$)
        if val(TD$)<2 then TD$="2"
        if METARcurrent then #1.Display "     ["; TD$; " minutes ago]"
    else
        #1.Display "*** TEST DATA ONLY ***"
    end if

    WW1$=MetarWord$ 'Metar Wind Word #1
    WindSpeed$=mid$(WW1$, 4, 2)
    WindDirection$=left$(WW1$, 3): WindDir=val(WindDirection$)
    if WindSpeed$="00" then #1.Display "Wind calm": goto [Visibility]
    WW2$=word$(Metar$, MetarWordNumber+1)
    if mid$(WW2$, 4, 1)="V" then 'variable wind direction
        FromDir=val(left$(WW2$, 3)): ToDir=val(right$(WW2$, 3))
        #1.Display "Wind variable from "; FromDir; " to "; ToDir; " degrees ";
        if FromDir=360 then FromDir=000
        if FromDir>ToDir then ToDir+=360
        if WindDir<FromDir then WindDir+=360
        if WindDir>FromDir and WindDir<ToDir then
            #1.Display "(median "; WindDirection$; ") ";
        end if
        x=instr(Metar$, WW2$)
        Metar$="T "+right$(Metar$, len(Metar$)-x-len(WW2$))
        goto [WindSpeed]
    end if
    if WindDirection$="VRB" then
        #1.Display "Wind variable ";
    else
        #1.Display "Wind from "; WindDirection$; " degrees (true) ";
    end if

[WindSpeed]
    #1.Display "at "; WindSpeed$; " knots";
    Gusting=instr(WW1$,"G")
    if Gusting then
        Gusting$=mid$(WW1$,Gusting+1, 2)
        #1.Display ", gusting to "; Gusting$;
    end if
    #1.Display ""

[Visibility]
    if not(instr(Metar$, "SM ")) then
        #1.Display "No visibility - report terminated"
        goto [Bottom]
    end if
    MetarVisibilityPosEnd=instr(Metar$, "SM ")-1
    MetarVisibilityPos=MetarVisibilityPosEnd
    Visibility$="": x$=""
    do until x$="T"
    x$=mid$(Metar$, MetarVisibilityPos, 1)
    Visibility$=x$+Visibility$
    MetarVisibilityPos-=1
    loop
    Visibility$=right$(Visibility$, len(Visibility$)-2)
    if left$(Visibility$,1)="M" then Visibility$="Less than " + right$(Visibility$, len(Visibility$)-1)
    #1.Display Visibility$; " mile visibility (statute miles)"

[GroundConditions]
    MetarSkyPos=instr(Metar$, "SM ")+3
    SkyCondition$=right$(Metar$, len(Metar$)-MetarSkyPos+1)
    for x=1 to 10
        y$=word$(SkyCondition$,x)
        if x=1 and left$(y$,1)="R" and instr(y$,"/")>0 and right$(y$,2)="FT" then
            Runway$=mid$(y$, 2, instr(y$,"/")-2)
            #1.Display "*** WARNING - Reduced visibility on runway "; Runway$; " ***   ["; y$; "]"
            goto [BumpFOR]
        end if
        CC$=left$(y$,2) 'Cloud Condition Code
        if CC$="CL" or CC$="SK" or CC$="FE" or CC$="SC" or CC$="BK" or CC$="OV" or CC$="VV" then
            FirstCC=x: exit for
        end if
        select case y$
            case   "-DZ": #1.Display "light drizzle"
            case    "DZ": #1.Display "drizzle"
            case   "+DZ": #1.Display "heavy drizzle"
            case   "-RA": #1.Display "light rain"
            case    "RA": #1.Display "rain"
            case   "+RA": #1.Display "heavy rain"
            case "-SHRA": #1.Display "light rainshowers"
            case  "SHRA": #1.Display "rainshowers"
            case "+SHRA": #1.Display "heavy rainshowers"
            case "-FZRA": #1.Display "light freezing rain"
            case  "FZRA": #1.Display "freezing rain"
            case "+FZRA": #1.Display "heavy freezing rain"
            case   "-SN": #1.Display "light snow"
            case    "SN": #1.Display "snow"
            case   "+SN": #1.Display "heavy snow"
            case  "DRSN": #1.Display "drifting snow"
            case    "GR": #1.Display "hail"
            case    "GS": #1.Display "sleet"
            case    "UP": #1.Display "precipitation"
            case "-FZFG": #1.Display "light freezing fog"
            case  "FZFG": #1.Display "freezing fog"
            case "+FZFG": #1.Display "heavy freezing fog"
            case    "FG": #1.Display "fog"
            case  "BCFG": #1.Display "patches of fog"
            case    "BR": #1.Display "mist"
            case    "FU": #1.Display "smoke"
            case    "HZ": #1.Display "haze"
            case    "SQ": #1.Display "squalls"
            case    "TS": #1.Display "thunderstorm"
            case  "TSRA": #1.Display "thunderstorm & rain"
            case  "-TSRA": #1.Display "thunderstorm & rain"
            case    "FC": #1.Display "funnel cloud"
            case    "VA": #1.Display "volcanic ash"
            case else   : #1.Display y$
        end select
[BumpFOR]
    next x

[SkyConditions]
    dim SkyCondition$(10): x=1: y=FirstCC
[Loop1]
    SkyCondition$(x)=word$(SkyCondition$, y)
    if instr(word$(SkyCondition$, y), "/")=0 then
        x+=1: y+=1: goto [Loop1]
    end if
    TemperatureDewpoint$=SkyCondition$(x) 'save for later

    MinBroken=99999: MinOvercast=99999
    #1.Display "Cloud Conditions: ";
    for y=1 to x-1
        '#1.Debug SkyCondition$(y);wait
        Clouds$=left$(SkyCondition$(y), 2)
        Altitude=val(mid$(SkyCondition$(y), 4, 3))*100           'right$(SkyCondition$(y),3))*100
        Altitude$=trim$(using("##,### feet", Altitude))
        select case Clouds$
            case "CL": #1.Display "clear";
            case "SK": #1.Display "clear";
            case "FE": #1.Display "a few at "; Altitude$;
            case "SC": #1.Display "scattered at "; Altitude$;
            case "BK": #1.Display "broken at "; Altitude$;
            MinBroken=min(Altitude, MinBroken)
            case "OV": #1.Display "overcast at "; Altitude$;
            MinOvercast=min(Altitude, MinOvercast)
            case "VV" : #1.Display "vertical visibility "; Altitude$;
            MinOvercast=min(Altitude, MinOvercast)
        end select
        if y=1 and Altitude<10000 and Altitude<>0 then #1.Display " (agl)";
        if y<x-1 then #1.Display ", ";
    next y
    #1.Display ""

    Ceiling=min(MinBroken, MinOvercast)
    MaxReportedCeiling=10000
    if Ceiling<MaxReportedCeiling then #1.Display "     [Ceiling is "; trim$(using("##,### feet", Ceiling)); "]"

[Temperature] 'TemperatureDewpoint$=SkyCondition$(x)
    Dewpoint$=mid$(TemperatureDewpoint$, instr(TemperatureDewpoint$, "/")+1)
    Temperature$=left$(TemperatureDewpoint$, len(TemperatureDewpoint$)-len(Dewpoint$)-1)
    if right$(Dewpoint$,2)="00" then Dewpoint$="zero"
    if left$(Dewpoint$,1)="M" then left$(Dewpoint$,1)="-"
    if right$(Temperature$,2)="00" then Temperature$="zero"
    if left$(Temperature$,1)="M" then left$(Temperature$,1)="-"
    #1.Display "Temperature "; Temperature$; " (celsius), dewpoint "; Dewpoint$
    #1.Display "     ["; trim$(using("+###", (val(Temperature$)*9/5+32))); " farenheit]"

[Pressure]
    Pressure$=right$(Metar$, 5)
    #1.Display "Altimeter "; right$(Pressure$, 4);
    if left$(Pressure$, 1)="A" then #1.Display  " (in. hg)"
    if left$(Pressure$, 1)="Q" then #1.Display  " (mm. hg)"

[Bottom]
    #1.Display "!Origin 0 0"
    #1.AirportCode "!SetFocus"
    #1.AirportCode "!SelectAll"
    Sel$=""
    #1 "show"
    wait

[ComboBoxClick]
    #1.ComboBox "SelectionIndex? SelIndex"
    #1.ComboBox "Selection? Sel$"
    Airport$ = Airports$(SelIndex, 0)
    #1.AirportCode Airport$
    #1.Display "!cls"
    #1.ComboBox "select 0"
    #1.ComboBox "!Select another Airport from this List or Enter an Airport Code"
    goto [ProcessAirport]

function AirportName$(Code$)
    AirportName$=Code$
    for x= 1 to val(Airports$(0,1))
        if Code$ = Airports$(x,0) then
            AirportName$ = Airports$(x,1)
            exit function
        end if
    next x
end function

sub Quit
    close #1
    end
end sub

function DownloadToFile(urlfile$, localfile$)
    open "URLmon" for dll as #url
    calldll #url, "URLDownloadToFileA",_
        0 as long,_         'null
        urlfile$ as ptr,_   'url to download
        localfile$ as ptr,_ 'save file name
        0 as long,_         'reserved, must be 0
        0 as long,_         'callback address, can be 0
        DownloadToFile as ulong  '0=success
    close #url
end function

function TimeDifference$(Time1$, Time2$)
    Hour1$=left$(Time1$,2): Hour1=val(Hour1$)
    Min1$= right$(Time1$,2): Min1=val(Min1$)
    Hour2$=left$(Time2$,2): Hour2=val(Hour2$)
    Min2$= right$(Time2$,2): Min2=val(Min2$)
    if Hour1<Hour2 then Hour1+=24
    if Min1<Min2 then Hour1-=1: Min1+=60

    HourDiff=Hour1-Hour2: MinDiff=Min1-Min2
    TotalDiff=(HourDiff*60)+MinDiff

    TimeDifference$=str$(TotalDiff)
end function

function AddLeadingZeros$(Number, Length)
    AddLeadingZeros$=str$(Number)
    ZerosNeeded=Length-len(AddLeadingZeros$)
    for x=1 to ZerosNeeded
        AddLeadingZeros$="0"+AddLeadingZeros$
    next x
end function

function exists(FileName$)
    files "", FileName$, FileDir$()
    FileCount$ = FileDir$(0, 0)
    exists = val(FileCount$)
end function  
US & Canada Airports.txt - (Put in the same folder as the .bas file)

Code: Select all

Abbotsford International Airport - CYXX - British Columbia - Canada
Akulivik Airport - CYKO - Quebec - Canada
Aklavik/Freddie Carmichael Airport - CYKD - Northwest Territories - Canada
Alert Airport - CYLT - Nunavut - Canada
Arctic Bay Airport - CYAB - Nunavut - Canada
Bagotville/Saguenay Airport - CYBG - Quebec - Canada
Baker Lake Airport - CYBK - Nunavut - Canada
Banff Airport - CYBA - Alberta - Canada
Bathurst Airport - CZBF - New Brunswick - Canada
Beaver Creek Airport - CYXQ - Yukon - Canada
Bella Bella (Campbell Island) Airport - CBBC - British Columbia - Canada
Bella Coola Airport - CYBD - British Columbia - Canada
Billy Bishop Toronto City Airport - CYTZ - Ontario - Canada
Brandon Municipal Airport - CYBR - Manitoba - Canada
Brochet Airport - CZWH - Manitoba - Canada
Cambridge Bay Airport - CYCB - Nunavut - Canada
Campbell River Airport - CYBL - British Columbia - Canada
Castlegar/West Kootenay Regional Airport - CYCG - British Columbia - Canada
Chetwynd Airport - CYCQ - British Columbia - Canada
Chevery Airport - CYHR - Quebec - Canada
Chibougamau/Chapais Airport - CYMT - Quebec - Canada
Chilliwack Airport - CYCW - British Columbia - Canada
Churchill Airport - CYYQ - Manitoba - Canada
Clyde River Airport - CYCY - Nunavut - Canada
Cold Lake Airport - CYOD - Alberta - Canada
Comox Airport - CYQQ - British Columbia - Canada
Coral Harbour Airport - CYZS - Nunavut - Canada
Cranbrook/Canadian Rockies International Airport - CYXC - British Columbia - Canada
Dauphin (Lt. Col W.G. (Billy) Barker VC Airport) - CYDN - Manitoba - Canada
Dawson City Airport - CYDA - Yukon - Canada
Dawson Creek Airport - CYDQ - British Columbia - Canada
Deer Lake Regional Airport - CYDF - Newfoundland and Labrador - Canada
Dryden Regional Airport - CYHD - Ontario - Canada
Edmonton International Airport - CYEG - Alberta - Canada
Edmonton/Villeneuve Airport - CZVL - Alberta - Canada
Fairview Airport - CEB5 - Alberta - Canada
Flin Flon Airport - CYFO - Manitoba - Canada
Fort Chipewyan Airport - CYPY - Alberta - Canada
Fort Frances Municipal Airport - CYAG - Ontario - Canada
Fort Good Hope Airport - CYGH - Northwest Territories - Canada
Fort McMurray International Airport - CYMM - Alberta - Canada
Fort Nelson Airport - CYYE - British Columbia - Canada
Fort Simpson Airport - CYFS - Northwest Territories - Canada
Fort Smith Airport - CYSM - Northwest Territories - Canada
Fredericton International Airport - CYFC - New Brunswick - Canada
Gander International Airport - CYQX - Newfoundland and Labrador - Canada
Gaspe Michel Pouliot Airport - CYGP - Quebec - Canada
Gillam Airport - CYGX - Manitoba - Canada
Gimli Industrial Park Airport - CYGM - Manitoba - Canada
Gjoa Haven Airport - CYHK - Nunavut - Canada
Goose Bay Airport - CYYR - Newfoundland and Labrador - Canada
Grande Prairie Airport - CYQU - Alberta - Canada
Grise Fiord Airport - CYGZ - Nunavut - Canada
Haines Junction Airport - CYHT - Yukon - Canada
Halifax Stanfield International Airport - CYHZ - Nova Scotia - Canada
Hamilton John C. Munro International Airport - CYHM - Ontario - Canada
High Level Airport - CYOJ - Alberta - Canada
Igloolik Airport - CYGT - Nunavut - Canada
Inuvik/Mike Zubko Airport - CYEV - Northwest Territories - Canada
Iqaluit Airport - CYFB - Nunavut - Canada
Island Lake/Garden Hill Airport - CYIV - Manitoba - Canada
Kamloops Airport - CYKA - British Columbia - Canada
Kasabonika Airport - CYAQ - Ontario - Canada
Kelowna International Airport - CYLW - British Columbia - Canada
Kenora Airport - CYQK - Ontario - Canada
Kingston/Norman Rogers Airport - CYGK - Ontario - Canada
Kugluktuk/Coppermine Airport - CYCO - Nunavut - Canada
Kuujjuaq Airport - CYVP - Quebec - Canada
La Grande Rivière Airport - CYGL - Quebec - Canada
La Ronge (Barber Field) Airport - CYVC - Saskatchewan - Canada
Lethbridge Airport - CYQL - Alberta - Canada
London International Airport - CYXU - Ontario - Canada
Lourdes-de-Blanc-Sablon Airport - CYBX - Quebec - Canada
Lynn Lake Airport - CYYL - Manitoba - Canada
Makkovik Airport - CYFT - Newfoundland and Labrador - Canada
Manitowaning/Manitoulin East Municipal Airport - CYEM - Ontario - Canada
Mayo Airport - CYMA - Yukon - Canada
Medicine Hat Airport - CYXH - Alberta - Canada
Mont-Joli Airport - CYYY - Quebec - Canada
Montreal/Mirabel International Airport - CYMX - Quebec - Canada
Montreal-Pierre Elliott Trudeau International Airport - CYUL - Quebec - Canada
Moose Jaw/Air Vice Marshal C. M. McEwen Airport - CYMJ - Saskatchewan - Canada
Moosonee Airport - CYMO - Ontario - Canada
Nain Airport - CYDP - Newfoundland and Labrador - Canada
Nanaimo Airport - CYCD - British Columbia - Canada
Natashquan Airport - CYNA - Quebec - Canada
North Bay/Jack Garland Airport - CYYB - Ontario - Canada
Norway House Airport - CYNE - Manitoba - Canada
Ottawa Macdonald-Cartier International Airport - CYOW - Ontario - Canada
Pangnirtung Airport - CYXP - Nunavut - Canada
Peace River Airport - CYPE - Alberta - Canada
Penticton Regional Airport - CYYF - British Columbia - Canada
Pickle Lake Airport - CYPL - Ontario - Canada
Pikangikum Airport - CJK2 - Ontario - Canada
Port Hope Simpson Airport - CCP4 - Newfoundland and Labrador - Canada
Portage la Prairie (Southport) Airport - CYPG - Manitoba - Canada
Prince Albert (Glass Field) Airport - CYPA - Saskatchewan - Canada
Prince George Airport - CYXS - British Columbia - Canada
Quebec City Jean Lesage International Airport - CYQB - Quebec - Canada
Quesnel Airport - CYQZ - British Columbia - Canada
Rankin Inlet Airport - CYRT - Nunavut - Canada
Red Deer Regional Airport - CYQF - Alberta - Canada
Regina International Airport - CYQR - Saskatchewan - Canada
Resolute Bay Airport - CYRB - Nunavut - Canada
Rouyn-Noranda Airport - CYUY - Quebec - Canada
Sachs Harbour (David Nasogaluak Jr. Saaryuaq) Airport - CYSY - Northwest Territories - Canada
Saint John Airport - CYSJ - New Brunswick - Canada
Sarnia/Chris Hadfield Airport - CYZR - Ontario - Canada
Saskatoon John G. Diefenbaker International Airport - CYXE - Saskatchewan - Canada
Sault Ste. Marie Airport - CYAM - Ontario - Canada
Sept-Iles Airport - CYZV - Quebec - Canada
Shearwater Airport - CYAW - Nova Scotia - Canada
Smithers Airport - CYYD - British Columbia - Canada
St. Anthony Airport - CYAY - Newfoundland and Labrador - Canada
St. John's International Airport - CYYT - Newfoundland and Labrador - Canada
Sudbury Airport - CYSB - Ontario - Canada
Sydney/J.A. Douglas McCurdy Airport - CYQY - Nova Scotia - Canada
Terrace-Kitimat Airport - CYXT - British Columbia - Canada
Thunder Bay International Airport - CYQT - Ontario - Canada
Timmins/Victor M. Power Airport - CYTS - Ontario - Canada
Toronto/Buttonville Municipal Airport - CYKZ - Ontario - Canada
Toronto/Billy Bishop Toronto City Airport - CYTZ - Ontario - Canada
Toronto Pearson International Airport - CYYZ - Ontario - Canada
Trois-Rivieres Airport - CYRQ - Quebec - Canada
Umiujaq Airport - CYMU - Quebec - Canada
Val-d'Or Airport - CYVO - Quebec - Canada
Vancouver International Airport - CYVR - British Columbia - Canada
Victoria International Airport - CYYJ - British Columbia - Canada
Wabush Airport - CYWK - Newfoundland and Labrador - Canada
Watson Lake Airport - CYQH - Yukon - Canada
Whitehorse Erik Nielsen International Airport - CYXY - Yukon - Canada
Williams Lake Airport - CYWL - British Columbia - Canada
Windsor International Airport - CYQG - Ontario - Canada
Winnipeg James Armstrong Richardson International Airport - CYWG - Manitoba - Canada
Yellowknife Airport - CYZF - Northwest Territories - Canada
Abilene Regional Airport - KABI - Texas - USA
Aberdeen Regional Airport - KABR - South Dakota - USA
Acadiana Regional Airport - KARA - Louisiana - USA
Adirondack Regional Airport - KSLK - New York - USA
Akron-Canton Airport - KCAK - Ohio - USA
Albany International Airport - KALB - New York - USA
Albany Southwest Georgia Regional Airport - KABY - Georgia - USA
Albuquerque International Sunport - ABQ - New Mexico - USA
Alexandria International Airport - AEX - Louisiana - USA
Allentown Lehigh Valley International Airport - ABE - Pennsylvania - USA
Alpena County Regional Airport - APN - Michigan - USA
Altoona-Blair County Airport - AOO - Pennsylvania - USA
Amarillo Rick Husband International Airport - AMA - Texas - USA
Anchorage Ted Stevens Anchorage International Airport - ANC - Alaska - USA
Appleton International Airport - ATW - Wisconsin - USA
Arcata-Eureka Airport - ACV - California - USA
Asheville Regional Airport - AVL - North Carolina - USA
Aspen/Pitkin County Airport - ASE - Colorado - USA
Athens Ben Epps Airport - AHN - Georgia - USA
Atlanta Hartsfield-Jackson Atlanta International Airport - ATL - Georgia - USA
Atlantic City International Airport - ACY - New Jersey - USA
Augusta Regional Airport - AGS - Georgia - USA
Austin-Bergstrom International Airport - AUS - Texas - USA
Bakersfield Meadows Field Airport - BFL - California - USA
Baltimore/Washington International Thurgood Marshall Airport - BWI - Maryland - USA
Bangor International Airport - BGR - Maine - USA
Bar Harbor Airport - BHB - Maine - USA
Baton Rouge Metropolitan Airport - BTR - Louisiana - USA
Beaumont Southeast Texas Regional Airport - BPT - Texas - USA
Billings Logan International Airport - BIL - Montana - USA
Binghamton Broome County Airport - BGM - New York - USA
Birmingham-Shuttlesworth International Airport - BHM - Alabama - USA
Bismarck Municipal Airport - BIS - North Dakota - USA
Bloomington/Normal Central Illinois Regional Airport - BMI - Illinois - USA
Boise Airport - BOI - Idaho - USA
Boston Logan International Airport - BOS - Massachusetts - USA
Bozeman Yellowstone International Airport - BZN - Montana - USA
Brownsville South Padre Island International Airport - BRO - Texas - USA
Brunswick Golden Isles Airport - BQK - Georgia - USA
Buffalo Niagara International Airport - BUF - New York - USA
Burbank Bob Hope Airport - BUR - California - USA
Burlington International Airport - BTV - Vermont - USA
Cedar Rapids Eastern Iowa Airport - CID - Iowa - USA
Champaign University of Illinois Willard Airport - CMI - Illinois - USA
Charleston Yeager Airport - CRW - West Virginia - USA
Charlotte Douglas International Airport - CLT - North Carolina - USA
Charlottesville Albemarle Airport - CHO - Virginia - USA
Chattanooga Metropolitan Airport - CHA - Tennessee - USA
Cheyenne Regional Airport - CYS - Wyoming - USA
Chicago Midway International Airport - MDW - Illinois - USA
Chicago O'Hare International Airport - ORD - Illinois - USA
Cincinnati Municipal Lunken Airport - LUK - Ohio - USA
Cincinnati/Northern Kentucky International Airport - CVG - Kentucky - USA
Cleveland Hopkins International Airport - CLE - Ohio - USA
Colorado Springs Airport - COS - Colorado - USA
Columbia Metropolitan Airport - CAE - South Carolina - USA
Columbus Metropolitan Airport - CSG - Georgia - USA
Columbus John Glenn Columbus International Airport - CMH - Ohio - USA
Corpus Christi International Airport - CRP - Texas - USA
Dallas Love Field Airport - DAL - Texas - USA
Dallas/Fort Worth International Airport - DFW - Texas - USA
Dayton International Airport - DAY - Ohio - USA
Daytona Beach International Airport - DAB - Florida - USA
Denver International Airport - DEN - Colorado - USA
Des Moines International Airport - DSM - Iowa - USA
Detroit Metropolitan Wayne County Airport - DTW - Michigan - USA
Durango La Plata County Airport - DRO - Colorado - USA
El Paso International Airport - ELP - Texas - USA
Eugene Airport - EUG - Oregon - USA
Evansville Regional Airport - EVV - Indiana - USA
Fairbanks International Airport - FAI - Alaska - USA
Fargo Hector International Airport - FAR - North Dakota - USA
Fayetteville Northwest Arkansas Regional Airport - XNA - Arkansas - USA
Fayetteville Regional Airport - FAY - North Carolina - USA
Flagstaff Pulliam Airport - FLG - Arizona - USA
Flint Bishop International Airport - FNT - Michigan - USA
Fort Lauderdale Executive Airport - FXE - Florida - USA
Fort Lauderdale Hollywood International Airport - FLL - Florida - USA
Fort Myers Southwest Florida International Airport - RSW - Florida - USA
Fort Smith Regional Airport - FSM - Arkansas - USA
Fort Wayne International Airport - FWA - Indiana - USA
Fresno Yosemite International Airport - FAT - California - USA
Gainesville Regional Airport - GNV - Florida - USA
Grand Junction Regional Airport - GJT - Colorado - USA
Grand Rapids Gerald R. Ford International Airport - GRR - Michigan - USA
Great Falls International Airport - GTF - Montana - USA
Greenville Spartanburg International Airport - GSP - South Carolina - USA
Gulfport Biloxi International Airport - GPT - Mississippi - USA
Hagerstown Regional Airport - HGR - Maryland - USA
Harrisburg International Airport - MDT - Pennsylvania - USA
Hartford Bradley International Airport - BDL - Connecticut - USA
Hays Regional Airport - HYS - Kansas - USA
Helena Regional Airport - HLN - Montana - USA
Hilton Head Island Airport - HHH - South Carolina - USA
Honolulu Daniel K. Inouye International Airport - HNL - Hawaii - USA
Houston George Bush Intercontinental Airport - IAH - Texas - USA
Houston William P. Hobby Airport - HOU - Texas - USA
Huntsville International Airport - HSV - Alabama - USA
Idaho Falls Regional Airport - IDA - Idaho - USA
Indianapolis International Airport - IND - Indiana - USA
International Falls Airport - INL - Minnesota - USA
Islip Long Island MacArthur Airport - ISP - New York - USA
Ithaca Tompkins Regional Airport - ITH - New York - USA
Jackson Medgar Wiley Evers International Airport - JAN - Mississippi - USA
Jackson Hole Airport - JAC - Wyoming - USA
Jacksonville International Airport - JAX - Florida - USA
Jacksonville Albert J. Ellis Airport - OAJ - North Carolina - USA
Juneau International Airport - JNU - Alaska - USA
Kahului Airport - OGG - Hawaii - USA
Kalamazoo Battle Creek International Airport - AZO - Michigan - USA
Kalispell Glacier Park International Airport - FCA - Montana - USA
Kansas City International Airport - MCI - Missouri - USA
Key West International Airport - EYW - Florida - USA
Killeen Fort Hood Regional Airport - GRK - Texas - USA
Knoxville McGhee Tyson Airport - TYS - Tennessee - USA
Kodiak Airport - ADQ - Alaska - USA
Kona International Airport at Keahole - KOA - Hawaii - USA
Kotzebue Ralph Wien Memorial Airport - OTZ - Alaska - USA
La Crosse Regional Airport - LSE - Wisconsin - USA
Lafayette Regional Airport - LFT - Louisiana - USA
Lake Charles Regional Airport - LCH - Louisiana - USA
Lansing Capital Region International Airport - LAN - Michigan - USA
Laramie Regional Airport - LAR - Wyoming - USA
Las Vegas McCarran International Airport - LAS - Nevada - USA
Lawton Fort Sill Regional Airport - LAW - Oklahoma - USA
Lewiston Nez Perce County Airport - LWS - Idaho - USA
Lexington Blue Grass Airport - LEX - Kentucky - USA
Liberal Mid-America Regional Airport - LBL - Kansas - USA
Lihue Airport - LIH - Hawaii - USA
Lincoln Airport - LNK - Nebraska - USA
Little Rock Clinton National Airport - LIT - Arkansas - USA
Long Beach Airport - LGB - California - USA
Longview East Texas Regional Airport - GGG - Texas - USA
Los Angeles International Airport - LAX - California - USA
Louisville Muhammad Ali International Airport - SDF - Kentucky - USA
Lubbock Preston Smith International Airport - LBB - Texas - USA
Lynchburg Regional Airport - LYH - Virginia - USA
Madison Dane County Regional Airport - MSN - Wisconsin - USA
Manchester Boston Regional Airport - MHT - New Hampshire - USA
Marquette Sawyer International Airport - MQT - Michigan - USA
Mason City Municipal Airport - MCW - Iowa - USA
McAllen Miller International Airport - MFE - Texas - USA
Medford Rogue Valley International Medford Airport - MFR - Oregon - USA
Melbourne Orlando International Airport - MLB - Florida - USA
Memphis International Airport - MEM - Tennessee - USA
Meridian Regional Airport - MEI - Mississippi - USA
Miami International Airport - MIA - Florida - USA
Midland International Air and Space Port - MAF - Texas - USA
Milwaukee Mitchell International Airport - MKE - Wisconsin - USA
Minneapolis Saint Paul International Airport - MSP - Minnesota - USA
Minot International Airport - MOT - North Dakota - USA
Missoula International Airport - MSO - Montana - USA
Mobile Regional Airport - MOB - Alabama - USA
Moline Quad City International Airport - MLI - Illinois - USA
Monroe Regional Airport - MLU - Louisiana - USA
Monterey Regional Airport - MRY - California - USA
Montgomery Regional Airport - MGM - Alabama - USA
Montrose Regional Airport
Montrose Regional Airport - MTJ - Colorado - USA
Mosinee Central Wisconsin Airport - CWA - Wisconsin - USA
Muncie Delaware County Regional Airport - MIE - Indiana - USA
Muscle Shoals Northwest Alabama Regional Airport - MSL - Alabama - USA
Muskegon County Airport - MKG - Michigan - USA
Myrtle Beach International Airport - MYR - South Carolina - USA
Nantucket Memorial Airport - ACK - Massachusetts - USA
Naples Municipal Airport - APF - Florida - USA
Nashville International Airport - BNA - Tennessee - USA
New Bern Coastal Carolina Regional Airport - EWN - North Carolina - USA
New Haven Tweed New Haven Airport - HVN - Connecticut - USA
New Orleans Louis Armstrong New Orleans International Airport - MSY - Louisiana - USA
New York John F. Kennedy International Airport - JFK - New York - USA
New York LaGuardia Airport - LGA - New York - USA
Newark Liberty International Airport - EWR - New Jersey - USA
Newport News/Williamsburg International Airport - PHF - Virginia - USA
Niagara Falls International Airport - IAG - New York - USA
Norfolk International Airport - ORF - Virginia - USA
North Bend Southwest Oregon Regional Airport - OTH - Oregon - USA
North Platte Regional Airport - LBF - Nebraska - USA
Oakland International Airport - OAK - California - USA
Ogden-Hinckley Airport - OGD - Utah - USA
Oklahoma City Will Rogers World Airport - OKC - Oklahoma - USA
Omaha Eppley Airfield - OMA - Nebraska - USA
Ontario International Airport - ONT - California - USA
Orange County John Wayne Airport - SNA - California - USA
Orlando International Airport - MCO - Florida - USA
Orlando Sanford International Airport - SFB - Florida - USA
Owensboro Daviess County Regional Airport - OWB - Kentucky - USA
Paducah Barkley Regional Airport - PAH - Kentucky - USA
Palm Springs International Airport - PSP - California - USA
Panama City Beach Northwest Florida Beaches International Airport - ECP - Florida - USA
Pensacola International Airport - PNS - Florida - USA
Peoria International Airport - PIA - Illinois - USA
Philadelphia International Airport - PHL - Pennsylvania - USA
Phoenix Sky Harbor International Airport - PHX - Arizona - USA
Pierre Regional Airport - PIR - South Dakota - USA
Pittsburgh International Airport - PIT - Pennsylvania - USA
Plattsburgh International Airport - PBG - New York - USA
Pocatello Regional Airport - PIH - Idaho - USA
Portland International Jetport - PWM - Maine - USA
Portland International Airport - PDX - Oregon - USA
Prescott Regional Airport - PRC - Arizona - USA
Providence Theodore Francis Green State Airport - PVD - Rhode Island - USA
Provo Municipal Airport - PVU - Utah - USA
Pueblo Memorial Airport - PUB - Colorado - USA
Pullman Moscow Regional Airport - PUW - Washington - USA
Raleigh-Durham International Airport - RDU - North Carolina - USA
Rapid City Regional Airport - RAP - South Dakota - USA
Redding Municipal Airport - RDD - California - USA
Reno-Tahoe International Airport - RNO - Nevada - USA
Richmond International Airport - RIC - Virginia - USA
Roanoke-Blacksburg Regional Airport - ROA - Virginia - USA
Rochester International Airport - RST - Minnesota - USA
Rochester Greater Rochester International Airport - ROC - New York - USA
Rockford Chicago Rockford International Airport - RFD - Illinois - USA
Rock Springs Sweetwater County Airport - RKS - Wyoming - USA
Roswell International Air Center - ROW - New Mexico - USA
Sacramento International Airport - SMF - California - USA
Saginaw MBS International Airport - MBS - Michigan - USA
Saint Cloud Regional Airport - STC - Minnesota - USA
Saint George Regional Airport - SGU - Utah - USA
Saint Louis Lambert International Airport - STL - Missouri - USA
Saint Petersburg Clearwater International Airport - PIE - Florida - USA
Salem McNary Field - SLE - Oregon - USA
Salina Regional Airport - SLN - Kansas - USA
Salt Lake City International Airport - SLC - Utah - USA
San Angelo Regional Airport - SJT - Texas - USA
San Antonio International Airport - SAT - Texas - USA
San Diego International Airport - SAN - California - USA
San Francisco International Airport - SFO - California - USA
San Jose Norman Y. Mineta International Airport - SJC - California - USA
San Luis Obispo County Regional Airport - SBP - California - USA
Santa Barbara Municipal Airport - SBA - California - USA
Santa Fe Municipal Airport - SAF - New Mexico - USA
Santa Maria Public Airport - SMX - California - USA
Sarasota-Bradenton International Airport - SRQ - Florida - USA
Savannah/Hilton Head International Airport - SAV - Georgia - USA
Seattle-Tacoma International Airport - SEA - Washington - USA
Shreveport Regional Airport - SHV - Louisiana - USA
Sioux Falls Regional Airport - FSD - South Dakota - USA
Sitka Rocky Gutierrez Airport - SIT - Alaska - USA
South Bend International Airport - SBN - Indiana - USA
Spokane International Airport - GEG - Washington - USA
Springfield-Branson National Airport - SGF - Missouri - USA
Springfield Abraham Lincoln Capital Airport - SPI - Illinois - USA
State College University Park Airport - SCE - Pennsylvania - USA
Stewart International Airport - SWF - New York - USA
Stockton Metropolitan Airport - SCK - California - USA
Syracuse Hancock International Airport - SYR - New York - USA
Tallahassee International Airport - TLH - Florida - USA
Tampa International Airport - TPA - Florida - USA
Texarkana Regional Airport - TXK - Arkansas - USA
Toledo Express Airport - TOL - Ohio - USA
Traverse City Cherry Capital Airport - TVC - Michigan - USA
Trenton-Mercer Airport - TTN - New Jersey - USA
Tucson International Airport - TUS - Arizona - USA
Tulsa International Airport - TUL - Oklahoma - USA
Twin Falls Joslin Field - Magic Valley Regional Airport - TWF - Idaho - USA
Tyler Pounds Regional Airport - TYR - Texas - USA
Valdosta Regional Airport - VLD - Georgia - USA
Valparaiso Northwest Florida Regional Airport - VPS - Florida - USA
Vero Beach Regional Airport - VRB - Florida - USA
Waco Regional Airport - ACT - Texas - USA
Washington Dulles International Airport - IAD - Virginia - USA
Washington Ronald Reagan Washington National Airport - DCA - Virginia - USA
Waterloo Regional Airport - ALO - Iowa - USA
Watertown International Airport - ART - New York - USA
Watertown Regional Airport - ATY - South Dakota - USA
Wausau Central Wisconsin Airport - CWA - Wisconsin - USA
West Palm Beach Palm Beach International Airport - PBI - Florida - USA
West Yellowstone Airport - WYS - Montana - USA
White Plains Westchester County Airport - HPN - New York - USA
Wichita Dwight D. Eisenhower National Airport - ICT - Kansas - USA
Wichita Falls Municipal Airport - SPS - Texas - USA
Wilkes-Barre/Scranton International Airport - AVP - Pennsylvania - USA
Williamsport Regional Airport - IPT - Pennsylvania - USA
Williston Basin International Airport - XWA - North Dakota - USA
Wilmington International Airport - ILM - North Carolina - USA
Worcester Regional Airport - ORH - Massachusetts - USA
Yakima Air Terminal - McAllister Field - YKM - Washington - USA
Yakutat Airport - YAK - Alaska - USA
Youngstown Warren Regional Airport - YNG - Ohio - USA
Yuma International Airport - YUM - Arizona - USA