Public Sub WEATHER() 'This is intended to help authors of third-party scripts for displaying WXSIM data, 'or for general interest for WXSIM users. A few lines irrelevant to this purpose have 'been removed. The variable wr$ is the weather type 1 and wr2$ is weather type 2, 'which is of secondary interest. The below is NOT the decision tree for output appearing 'in plaintext.txt. That is a separate algorithm developed much later in response to 'requests for plain language output from WXSIM for standard time periods such as 6 or '12 hours. There are occasionals in which a weather type, such as fog, may appear in 'one of these outputs (scrolling text/latest.csv or plaintext.txt) and not in the other. ' 'c(i) is fractional cloud cover at the ith layer 't(i) is cloud opacity on a 0-5 scale at the ith layer 'ke(i) is temperature at the ith layer 'fg is a fog variable equal to 1 for no fog and approaching 0 for very dense fog 'te is near-surface air temperature in Kelvins 'dn is near-surface dew point in Kelvins 'te is near-surface wet bulb temperature in Kelvins 'rh is near-surface relative humidity in % 'ws is 10 meter wind speed in miles per hour ' 'There are more variables I will not define here skd = 1 For i = 1 To 5 skd = skd * (1 - c(i) * t(i) / 6) Next skd45 = 1 For i = 4 To 5 skd45 = skd45 * (1 - c(i) * t(i) / 6) Next wr$ = "CLEAR" If skd < 0.97 Then wr$ = "CLR-FAIR" If skd < 0.94 Then wr$ = "FAIR" If skd < 0.9 Then wr$ = "FAIR-P.C." If skd < 0.83 Then wr$ = "P.CLOUDY" If skd < 0.7 Then wr$ = "P.-M.CLDY" If skd < 0.6 Then wr$ = "M.CLOUDY" If skd < 0.5 Then wr$ = "M.C.-CLDY" If skd < 0.4 Then wr$ = "CLOUDY" If skd < 0.27 Then wr$ = "DNS.OVCST" If wr$ = "CLR-FAIR" And al > 0.04 Then wr$ = "SUNNY" If wr$ = "FAIR" And al > 0.04 Then wr$ = "M.SUNNY" If (wr$ = "SUNNY" Or wr$ = "M.SUNNY") And hz >= 2 Then wr$ = "HAZY SUN" wr2$ = "" fg = 1 dewf = a / a2 * (dn - te + 2.7 + rtc / 4) * 4 / (ws + 6) + 2 * tvp dewfvly = a / a2 * (dn - (tvy + 0.9) + 2.7 + rtc / 4) * 4 / (ws + 6) + 2 * tvp If dewf > 0.3 Then wr2$ = "LIGHT DEW" If dewf > 0.6 Then wr2$ = "MOD. DEW" If dewf > 0.9 Then wr2$ = "HEAVY DEW" If dewfvly > 0.3 And tvy - iv2 < 271.3 Then wr2$ = "SCTD.FROST" If dewf > 0.3 And grasst < 272.1 Then wr2$ = "LT. FROST" If dewf > 0.6 And grasst < 271.3 Then wr2$ = "MOD. FROST" If dewf > 0.9 And grasst < 270.5 Then wr2$ = "HVY. FROST" If fa$ = "n" Or rh < rhs Then fg = 1: e(0) = 1: ga(0) = 0 If fa$ = "y" And rh >= rhs Then fg = (1 - rtc / 8) * 0.7 * (rh - rhs) / 9 * (4 - Sqr(Abs(5 - ws))) * (32 - bp) * 0.17 * (18 + q3) / 20 fg = 1 - fg * (dn / 287) ^ 8 - (tvp - tvp91) / 4 * fsen / 3 If fg < 0 Then fg = 0 If fg < 0.3 Then fg = 0.3 - 0.1 * ((0.3 - fg) / 0.3) ^ 1 fg = fg ^ ((fsen + 2) / 6) If fg > 1 Then fg = 1 fg = 0.5 * (1 - (1 - fg) * w(1) * w(2) * w(3) * w(4) * w(5)) + 0.5 * fg End If e(0) = fg ^ 0.3 / (1 + 1.6 * (1 - c(2)) * ip ^ 0.3): ga(0) = (te / 100) ^ 4 * (1 - e(0)) If fg < 0.85 Then wr2$ = "LIGHT FOG" If fg < 0.63 Then wr2$ = "MOD. FOG" If fg < 0.35 Then wr2$ = "DENSE FOG" If ip = 0 And prd < 0.1 And prs < 0.1 Then GoTo 750 ptp = 1: fpt = 1 If ip >= 3 Then wr2$ = "HEAVY RAIN" If ip < 3 Then wr2$ = "MOD. RAIN" If ip < 2 Then wr2$ = "LIGHT RAIN" If ip < 1 Then wr2$ = "DRIZZLE" If ip = 0 Then If prd > 0.1 Then wr2$ = "CHNC. DRZL" If prd > 0.3 Then wr2$ = "PROB. DRZL" If prs > 0.1 Then wr2$ = "CHNC. SHWR" If prs > 0.3 Then wr2$ = "PROB. SHWR" End If styp = 1 If c(3) * t(3) >= 3 And ke(3) < 271 Then styp = 2 If styp = 2 And ke(3) < 267 Then styp = 3 If c(3) * t(3) < 3 And (ke(3) + ke(2)) < 546 Then styp = 2 If styp = 2 And (ke(3) + ke(2)) < 543 Then styp = 3 If ke(2) > 272 + ip / 3 And styp = 3 Then styp = 2 If ke(2) > 274 + ip / 3 Then styp = 1 fpt = 1 rhfc = ke(2) + ke(3) + 0.4 * rh + 1.4 * (1.4 * te + dp) If c(1) < 0.3 And ke(2) < 277 And te < 280 Then If rhfc < 1488 Then fpt = 3: If te < 273 Then fpt = 4 If rhfc < 1475 Then fpt = 6 End If eft = (ke(1) + te + wb) / 3 fp = -2.5 * Atn((ke(2) - 273) / 3) + 273 If styp = 1 Then If te <= 273 Then fpt = 2 If eft < fp + 1 Then fpt = 3: If te <= 273 Then fpt = 4 If ke(2) < 273 And eft < fp Then fpt = 5 'not sure about this one If eft < fp - 1 Then fpt = 6 If te > 280 Or wb > 274.9 Or eft > 276.7 Then fpt = 1 'to protect against crazy warm snow If te = 0 Then MsgBox "Zero absolute temperature, indicating a possible data problem. Please report to the program's author.": fpt = 1 'to protect against crazy random freezing rain End If If styp = 2 Then fpt = 9 If te > 277.9 Or wb > 274.3 Or eft > 275 Then fpt = 10 If te > 280 Or wb > 274.9 Or eft > 276.7 Then fpt = 1 If te <= 273 Then fpt = 4 'may change this to frz rn/mix If eft < fp + 1 Then fpt = 5: If te <= 273 Then fpt = 4 'may change wording to rn/mix If eft < fp - 1 Then fpt = 7 If te > 280 Or wb > 274.9 Or eft > 276.7 Then fpt = 1 'to protect against crazy warm snow End If If styp = 3 Then fpt = 8 If (te > 276.6 Or wb > 273.8 Or eft > 273.9) Then fpt = 9 If (fpt = 8 Or fpt = 9) And (te > 277.9 Or wb > 274.3 Or eft > 275) Then fpt = 10 If (fpt = 8 Or fpt = 9 Or fpt = 10) And (te > 280 Or wb > 274.9 Or eft > 276.7) Then fpt = 1 End If If (fpt = 1 Or fpt = 8 Or fpt = 9 Or fpt = 10) Then If fpt = 1 And snlvl < el + 700 Then snlvl = 0.55 * snlvl + 0.45 * (el + 700) If fpt = 10 Then snlvl = 0.55 * snlvl + 0.45 * (el + 400) If fpt = 9 Then snlvl = 0.55 * snlvl + 0.45 * (el + 100) If fpt = 8 And snlvl > el - 200 Then snlvl = 0.55 * snlvl + 0.45 * (el - 200) fptt = fpt: If fpt = 1 Then fptt = 11 tfsl = 12 + (snlvl - el - 1000) / 300 If tfsl > 12 Then tfsl = 12 If tfsl < 7 Then tfsl = 7 fptt = CInt(0.33 * tfsl + 0.67 * fptt) fpt = fptt: If fpt = 11 Then fpt = 1 End If If fpt = 2 Then ptp = 2 If ip >= 3 Then wr2$ = "ICE STORM" If ip < 3 Then wr2$ = "FRZ. RAIN" If ip < 1 Then wr2$ = "FRZ. DRZL" If ip = 0 Then If prd > 0.1 Or prs > 0.1 Then wr2$ = "CH. FRZ.RN" If prd > 0.3 Or prs > 0.3 Then wr2$ = "PR. FRZ.RN" End If End If If fpt = 3 Then ptp = 2 wr2$ = "RAIN/SLEET" If ip = 0 Then If prd > 0.1 Or prs > 0.1 Then wr2$ = "CH. RN/SLT" If prd > 0.3 Or prs > 0.3 Then wr2$ = "PR. RN/SLT" End If End If If fpt = 4 Then ptp = 2 wr2$ = "SLT/FRZ.RN" If ip = 0 Then If prd > 0.1 Or prs > 0.1 Then wr2$ = "CH. SLT/FR" If prd > 0.3 Or prs > 0.3 Then wr2$ = "PR. SLT/FR" End If End If If fpt = 5 Then ptp = 2 wr2$ = "SLEET/MIX" If ip < 1.7 Then wr2$ = "LT.SLT/MIX" If ip > 2.5 Then wr2$ = "HVY.SLT/MX" If ip = 0 Then If prd > 0.1 Or prs > 0.1 Then wr2$ = "CH.SLT/MIX" If prd > 0.3 Or prs > 0.3 Then wr2$ = "PR.SLT/MIX" End If End If If fpt = 6 Then ptp = 3 If ip <= 1.9 Then wr2$ = "LT. SLEET" If ip > 1.9 Then wr2$ = "MOD. SLEET" If ip > 2.8 Then wr2$ = "HVY. SLEET" If ip = 0 Then If prd > 0.1 Or prs > 0.1 Then wr2$ = "CHNC.SLEET" If prd > 0.3 Or prs > 0.3 Then wr2$ = "PROB.SLEET" End If End If If fpt = 7 Then ptp = 3 wr2$ = "SLEET/SNOW" If ip < 1.6 Then wr2$ = "LT.SLT/SNW" If ip > 2.4 Then wr2$ = "HVY.SLT/SN" If ip = 0 Then If prd > 0.1 Or prs > 0.1 Then wr2$ = "CH.SLT/SNW" If prd > 0.3 Or prs > 0.3 Then wr2$ = "PR.SLT/SNW" End If End If If fpt = 8 Then ptp = 3 If ip <= 0.7 Then wr2$ = "SN. FLURRY" If ip > 0.7 Then wr2$ = "LIGHT SNOW" If ip > 1.32 Then wr2$ = "MOD. SNOW" If ip > 2.05 Then wr2$ = "HEAVY SNOW" If ws > 20 And te < 266 And ip > 1.5 Then wr2$ = "BLIZZARD" If ip = 0 Then If prd > 0.1 Or prs > 0.1 Then wr2$ = "CHNC. SNOW" If prd > 0.3 Or prs > 0.3 Then wr2$ = "PROB. SNOW" End If End If If fpt = 9 Then ptp = 2 wr2$ = "SNOW/RAIN" If ip < 1.5 Then wr2$ = "LT. SNW/RN" If ip > 2.3 Then wr2$ = "HVY.SNW/RN" If ip = 0 Then If prd > 0.1 Or prs > 0.1 Then wr2$ = "CH. SNW/RN" If prd > 0.3 Or prs > 0.3 Then wr2$ = "PR. SNW/RN" End If End If If fpt = 10 Then ptp = 2 wr2$ = "RAIN/SNOW" If ip < 1.8 Then wr2$ = "LT. RN/SNW" If ip > 2.6 Then wr2$ = "HVY.RN/SNW" If ip = 0 Then If prd > 0.1 Or prs > 0.1 Then wr2$ = "CH. RN/SNW" If prd > 0.3 Or prs > 0.3 Then wr2$ = "PR. RN/SNW" End If End If 750 If ip > 0 Then pef If Len(wr$) < 10 Then Do: wr$ = wr$ & " ": Loop Until Len(wr$) = 10 End If wr$ = wr$ & wr2$ & " " End Sub ====================================================================================== List of plaintext.txt words or terms: WXSIM text forecast for initialized at feet meters above sea level. above ground. Rest of tonight Low Minimum freezing level Minimum snow level High Maximum freezing level Maximum snow level night Today Tonight This afternoon in the morning in the afternoon after midnight , then , becoming , but temperatures falling in the afternoon. , but temperatures rising after midnight. around , gusting to , occasionally gusting to near calm Breezy Windy Very windy cold cool relatively cool very cold unusually cold unusually cool extremely cold exceptionally cold exceptionally cool near record cold near record low temperatures warm mild relatively mild unusually warm unusually mild exceptionally warm exceptionally mild near record warmth near record cool temperatures with and hot very hot extremely hot exceptionally hot unusually hot near record heat Wind chill ranging from to Wind chill as low as Wind chill around scattered light frost possible. areas of light frost likely. light to moderate frost. moderate to heavy frost. Heat index Humidex up to UV index up to Chance of precipitation percent. Chance of precipitation less than 20 percent. Chance of precipitation near 100 percent. Precipitation mostly Precipitation showery or intermittent. Scattered showers possible. Scattered thundershowers possible. Scattered thunderstorms likely. Scattered thunderstorms likely, some possibly severe. Thunderstorms very likely, some possibly severe. Thunderstorms very likely, some severe. Severe thunderstorms likely, with possible tornados. Precipitation (liquid equivalent) mostly Snow Ice (on ground) Snow or ice (on ground) less than a tenth of an inch. around a tenth of an inch. less than a quarter of an inch. around a quarter of an inch. between a quarter and half an inch. around half an inch. between half an inch and one inch. around an inch. between 1 and 2 inches. around 2 inches. between 2 and 3 inches. around 3 inches. between 3 and 5 inches. between 4 and 6 inches. over six inches. No accumulation expected. Little or no accumulation about a quarter inch. accumulation about half an inch. accumulation about an inch. accumulation 1 to 2 inches. accumulation around 2 inches. accumulation 2 to 3 inches. accumulation 2 to 4 inches. accumulation 3 to 5 inches. accumulation 4 to 6 inches. accumulation 5 to 8 inches. accumulation 6 to 10 inches. accumulation 8 to 12 inches. accumulation 12 to 16 inches. accumulation 15 to 20 inches. accumulation 20 inches or more. Above-ground freezing rain accumulation up to inches. Little if any freezing rain accumulation. less than 2 mm. around 2 mm. between 2 and 5 mm. around 5 mm. between 5 and 10 mm. around 10 mm. between 10 and 20 mm. around 20 mm. between 20 and 30 mm. around 30 mm. between 30 and 50 mm. between 40 and 60 mm. over 60 mm. accumulation less than one cm. accumulation about a cm. accumulation 1 to 2 cm. accumulation about 2 cm. accumulation 2 to 3 cm. accumulation 2 to 4 cm. accumulation 3 to 5 cm. accumulation 4 to 6 cm. accumulation 5 to 8 cm. accumulation 6 to 10 cm. accumulation 8 to 12 cm. accumulation 12 to 16 cm. accumulation 15 to 20 cm. accumulation 20 to 30 cm. accumulation 30 to 40 cm. accumulation 40 to 50 cm. accumulation 50 cm or more. mm. clear sunny mostly clear fair mostly sunny fair to partly cloudy partly to mostly sunny partly cloudy partly to mostly cloudy mostly cloudy mostly cloudy to cloudy cloudy dense overcast clear except for a few wispy clouds sunny, with just a few wispy clouds mostly clear, with just a few high thin clouds sunny, with just a few high thin clouds fair, but some high thin clouds mostly sunny, but some high thin clouds mostly fair, but some high cloudiness partly to mostly sunny, but some high cloudiness patchy light fog light to moderate fog moderate fog moderate to dense fog dense fog a mix of a slight chance of a chance of likely very likely north north-northeast northeast east-northeast east east-southeast southeast south-southeast south south-southwest southwest west-southwest west west-northwest northwest north-northwest * THIS FORECAST WAS MADE IN AUTOMATED MODE AND MAY BE LESS ACCURATE THAN OTHERWISE * rain freezing rain sleet snow