avwx.static.core

Core static values for internal and external use.

METAR and TAF reports come in two variants depending on the station's location: North American & International. This affects both element parsing and inferred units of measurement. AVWX determines this by looking at the station's ICAO value.

  1"""Core static values for internal and external use.
  2
  3METAR and TAF reports come in two variants depending on the station's
  4location: North American & International. This affects both element
  5parsing and inferred units of measurement. AVWX determines this by
  6looking at the station's ICAO value.
  7"""
  8
  9NA_REGIONS = (
 10    "C",
 11    "K",
 12    "P",
 13    "T",
 14)
 15"""Station Location Identifiers - North American formatting"""
 16
 17IN_REGIONS = (
 18    "A",
 19    "B",
 20    "D",
 21    "E",
 22    "F",
 23    "G",
 24    "H",
 25    "L",
 26    "N",
 27    "O",
 28    "R",
 29    "S",
 30    "U",
 31    "V",
 32    "W",
 33    "Y",
 34    "Z",
 35)
 36"""Station Location Identifiers - International formatting"""
 37
 38# The Central American region is split. Therefore we need to use the first two letters
 39M_NA_REGIONS = (
 40    "MB",
 41    "MM",
 42    "MT",
 43    "MY",
 44)
 45"""Central America Station Location Identifiers - North American formatting"""
 46
 47M_IN_REGIONS = (
 48    "MD",
 49    "MG",
 50    "MH",
 51    "MK",
 52    "MN",
 53    "MP",
 54    "MR",
 55    "MS",
 56    "MU",
 57    "MW",
 58    "MZ",
 59)
 60"""Central America Station Location Identifiers - International formatting"""
 61
 62NA_UNITS = {
 63    "altimeter": "inHg",
 64    "altitude": "ft",
 65    "accumulation": "in",
 66    "temperature": "C",
 67    "visibility": "sm",
 68    "wind_speed": "kt",
 69}
 70"""North American variant units"""
 71
 72IN_UNITS = {
 73    "altimeter": "hPa",
 74    "altitude": "ft",
 75    "accumulation": "in",
 76    "temperature": "C",
 77    "visibility": "m",
 78    "wind_speed": "kt",
 79}
 80"""International variant units"""
 81
 82WIND_UNITS = {
 83    "KT": "kt",
 84    "KTS": "kt",
 85    "MPS": "m/s",
 86    "KMH": "km/h",
 87    "MPH": "mi/h",
 88}
 89"""Expected unit postfixes for wind elements in order of frequency"""
 90
 91FLIGHT_RULES = (
 92    "VFR",
 93    "MVFR",
 94    "IFR",
 95    "LIFR",
 96)
 97"""List of flight rules abbreviations"""
 98
 99CLOUD_LIST = (
100    "FEW",
101    "SCT",
102    "BKN",
103    "OVC",
104)
105"""List of cloud layer abbreviations"""
106
107CARDINALS = {
108    "N": 360,
109    "NORTH": 360,
110    "NE": 45,
111    "E": 90,
112    "EAST": 90,
113    "SE": 135,
114    "S": 180,
115    "SOUTH": 180,
116    "SW": 225,
117    "W": 270,
118    "WEST": 270,
119    "NW": 315,
120}
121"""Dictionary of cardinal direction values"""
122
123CARDINAL_DEGREES = {
124    "NNE": 22.5,
125    "NE": 45,
126    "ENE": 67.5,
127    "E": 90,
128    "ESE": 112.5,
129    "SE": 135,
130    "SSE": 157.5,
131    "S": 180,
132    "SSW": 202.5,
133    "SW": 225,
134    "WSW": 247.5,
135    "W": 270,
136    "WNW": 292.5,
137    "NW": 315,
138    "NNW": 337.5,
139    "N": 0,
140}
141"""Dictionary of tertiary cardinal directions to degree values with North at 0"""
142
143WX_TRANSLATIONS = {
144    "BC": "Patchy",
145    "BL": "Blowing",
146    "BR": "Mist",
147    "DR": "Low Drifting",
148    "DS": "Duststorm",
149    "DU": "Wide Dust",
150    "DZ": "Drizzle",
151    "FC": "Funnel Cloud",
152    "FG": "Fog",
153    "FU": "Smoke",
154    "FZ": "Freezing",
155    "GR": "Hail",
156    "GS": "Small Hail",
157    "HZ": "Haze",
158    "IC": "Ice Crystals",
159    "MI": "Shallow",
160    "PL": "Ice Pellets",
161    "PO": "Dust Whirls",
162    "PR": "Partial",
163    "PY": "Spray",
164    "RA": "Rain",
165    "SA": "Sand",
166    "SG": "Snow Grains",
167    "SH": "Showers",
168    "SN": "Snow",
169    "SQ": "Squall",
170    "SS": "Sandstorm",
171    "SY": "Spray",
172    "TS": "Thunderstorm",
173    "UP": "Unknown Precip",
174    "VA": "Volcanic Ash",
175    "VC": "Vicinity",
176}
177"""Dictionary associating WX codes with descriptions"""
178
179CLOUD_TRANSLATIONS = {
180    "OVC": "Overcast layer at {0}{1}",
181    "BKN": "Broken layer at {0}{1}",
182    "SCT": "Scattered clouds at {0}{1}",
183    "FEW": "Few clouds at {0}{1}",
184    "VV": "Vertical visibility up to {0}{1}",
185    "CLR": "Sky Clear",
186    "SKC": "Sky Clear",
187    "AC": "Altocumulus",
188    "ACC": "Altocumulus Castellanus",
189    "AS": "Altostratus",
190    "CB": "Cumulonimbus",
191    "CC": "Cirrocumulus",
192    "CI": "Cirrus",
193    "CS": "Cirrostratus",
194    "CU": "Cumulus",
195    "FC": "Fractocumulus",
196    "FS": "Fractostratus",
197    "NS": "Nimbostratus",
198    "SC": "Stratocumulus",
199    "ST": "Stratus",
200    "TCU": "Towering Cumulus",
201    None: "Unknown",
202}
203"""Dictionary associating cloud layer and cloud codes with descriptions"""
204
205SPOKEN_UNITS = {
206    "sm": "mile",
207    "mi": "mile",
208    "km": "kilometer",
209    "C": "Celsius",
210    "F": "Fahrenheit",
211    "kt": "knot",
212}
213"""Units required to be translated in order to be spoken properly"""
214
215NUMBER_REPL = {
216    ".": "point",
217    "-": "minus",
218    "M": "minus",
219    "0": "zero",
220    "1": "one",
221    "2": "two",
222    "3": "three",
223    "4": "four",
224    "5": "five",
225    "6": "six",
226    "7": "seven",
227    "8": "eight",
228    "9": "nine",
229}
230"""Dictionary associating algebraic signs with their spoken version"""
231
232FRACTIONS = {"1/4": "one quarter", "1/2": "one half", "3/4": "three quarters"}
233"""Dictionary associating fraction strings with their spoken version"""
234
235SPECIAL_NUMBERS = {
236    "CAVOK": (9999, "ceiling and visibility ok"),
237    "VRB": (None, "variable"),
238    "CLM": (0, "calm"),
239    "SFC": (0, "surface"),
240    "GND": (0, "ground"),
241    "STNR": (0, "stationary"),
242    "LTL": (0, "little"),
243    "FRZLVL": (None, "freezing level"),
244    "UNL": (999, "Unlimited"),
245}
246"""Dictionary associating special number values with their spoken version"""
247
248REMARKS_ELEMENTS = {
249    "$": "ASOS requires maintenance",
250    "AO1": "Automated with no precipitation sensor",
251    "AO2": "Automated with precipitation sensor",
252    "ADVISORY": "Advisory only. Do not use for flight planning",
253    "BINOVC": "Breaks in Overcast",
254    "FZRANO": "Freezing rain information not available",
255    "NOSPECI": "No SPECI reports taken",
256    "P0000": "Trace amount of rain in the last hour",
257    "PNO": "Precipitation amount not available",
258    "PRESFR": "Pressure Falling Rapidly",
259    "PRESRR": "Pressure Rising Rapidly",
260    "PWINO": "Precipitation identifier information not available",
261    "RVRNO": "Runway Visual Range missing",
262    "SLPNO": "Sea level pressure not available",
263    "SOG": "Snow on the ground",
264    "TSNO": "Thunderstorm information not available",
265}
266"""Static remarks translation elements"""
267
268REMARKS_GROUPS = {"ACFT MSHP": "Aircraft mishap"}
269"""Static remarks translation groups"""
NA_REGIONS = ('C', 'K', 'P', 'T')

Station Location Identifiers - North American formatting

IN_REGIONS = ('A', 'B', 'D', 'E', 'F', 'G', 'H', 'L', 'N', 'O', 'R', 'S', 'U', 'V', 'W', 'Y', 'Z')

Station Location Identifiers - International formatting

M_NA_REGIONS = ('MB', 'MM', 'MT', 'MY')

Central America Station Location Identifiers - North American formatting

M_IN_REGIONS = ('MD', 'MG', 'MH', 'MK', 'MN', 'MP', 'MR', 'MS', 'MU', 'MW', 'MZ')

Central America Station Location Identifiers - International formatting

NA_UNITS = {'altimeter': 'inHg', 'altitude': 'ft', 'accumulation': 'in', 'temperature': 'C', 'visibility': 'sm', 'wind_speed': 'kt'}

North American variant units

IN_UNITS = {'altimeter': 'hPa', 'altitude': 'ft', 'accumulation': 'in', 'temperature': 'C', 'visibility': 'm', 'wind_speed': 'kt'}

International variant units

WIND_UNITS = {'KT': 'kt', 'KTS': 'kt', 'MPS': 'm/s', 'KMH': 'km/h', 'MPH': 'mi/h'}

Expected unit postfixes for wind elements in order of frequency

FLIGHT_RULES = ('VFR', 'MVFR', 'IFR', 'LIFR')

List of flight rules abbreviations

CLOUD_LIST = ('FEW', 'SCT', 'BKN', 'OVC')

List of cloud layer abbreviations

CARDINALS = {'N': 360, 'NORTH': 360, 'NE': 45, 'E': 90, 'EAST': 90, 'SE': 135, 'S': 180, 'SOUTH': 180, 'SW': 225, 'W': 270, 'WEST': 270, 'NW': 315}

Dictionary of cardinal direction values

CARDINAL_DEGREES = {'NNE': 22.5, 'NE': 45, 'ENE': 67.5, 'E': 90, 'ESE': 112.5, 'SE': 135, 'SSE': 157.5, 'S': 180, 'SSW': 202.5, 'SW': 225, 'WSW': 247.5, 'W': 270, 'WNW': 292.5, 'NW': 315, 'NNW': 337.5, 'N': 0}

Dictionary of tertiary cardinal directions to degree values with North at 0

WX_TRANSLATIONS = {'BC': 'Patchy', 'BL': 'Blowing', 'BR': 'Mist', 'DR': 'Low Drifting', 'DS': 'Duststorm', 'DU': 'Wide Dust', 'DZ': 'Drizzle', 'FC': 'Funnel Cloud', 'FG': 'Fog', 'FU': 'Smoke', 'FZ': 'Freezing', 'GR': 'Hail', 'GS': 'Small Hail', 'HZ': 'Haze', 'IC': 'Ice Crystals', 'MI': 'Shallow', 'PL': 'Ice Pellets', 'PO': 'Dust Whirls', 'PR': 'Partial', 'PY': 'Spray', 'RA': 'Rain', 'SA': 'Sand', 'SG': 'Snow Grains', 'SH': 'Showers', 'SN': 'Snow', 'SQ': 'Squall', 'SS': 'Sandstorm', 'SY': 'Spray', 'TS': 'Thunderstorm', 'UP': 'Unknown Precip', 'VA': 'Volcanic Ash', 'VC': 'Vicinity'}

Dictionary associating WX codes with descriptions

CLOUD_TRANSLATIONS = {'OVC': 'Overcast layer at {0}{1}', 'BKN': 'Broken layer at {0}{1}', 'SCT': 'Scattered clouds at {0}{1}', 'FEW': 'Few clouds at {0}{1}', 'VV': 'Vertical visibility up to {0}{1}', 'CLR': 'Sky Clear', 'SKC': 'Sky Clear', 'AC': 'Altocumulus', 'ACC': 'Altocumulus Castellanus', 'AS': 'Altostratus', 'CB': 'Cumulonimbus', 'CC': 'Cirrocumulus', 'CI': 'Cirrus', 'CS': 'Cirrostratus', 'CU': 'Cumulus', 'FC': 'Fractocumulus', 'FS': 'Fractostratus', 'NS': 'Nimbostratus', 'SC': 'Stratocumulus', 'ST': 'Stratus', 'TCU': 'Towering Cumulus', None: 'Unknown'}

Dictionary associating cloud layer and cloud codes with descriptions

SPOKEN_UNITS = {'sm': 'mile', 'mi': 'mile', 'km': 'kilometer', 'C': 'Celsius', 'F': 'Fahrenheit', 'kt': 'knot'}

Units required to be translated in order to be spoken properly

NUMBER_REPL = {'.': 'point', '-': 'minus', 'M': 'minus', '0': 'zero', '1': 'one', '2': 'two', '3': 'three', '4': 'four', '5': 'five', '6': 'six', '7': 'seven', '8': 'eight', '9': 'nine'}

Dictionary associating algebraic signs with their spoken version

FRACTIONS = {'1/4': 'one quarter', '1/2': 'one half', '3/4': 'three quarters'}

Dictionary associating fraction strings with their spoken version

SPECIAL_NUMBERS = {'CAVOK': (9999, 'ceiling and visibility ok'), 'VRB': (None, 'variable'), 'CLM': (0, 'calm'), 'SFC': (0, 'surface'), 'GND': (0, 'ground'), 'STNR': (0, 'stationary'), 'LTL': (0, 'little'), 'FRZLVL': (None, 'freezing level'), 'UNL': (999, 'Unlimited')}

Dictionary associating special number values with their spoken version

REMARKS_ELEMENTS = {'$': 'ASOS requires maintenance', 'AO1': 'Automated with no precipitation sensor', 'AO2': 'Automated with precipitation sensor', 'ADVISORY': 'Advisory only. Do not use for flight planning', 'BINOVC': 'Breaks in Overcast', 'FZRANO': 'Freezing rain information not available', 'NOSPECI': 'No SPECI reports taken', 'P0000': 'Trace amount of rain in the last hour', 'PNO': 'Precipitation amount not available', 'PRESFR': 'Pressure Falling Rapidly', 'PRESRR': 'Pressure Rising Rapidly', 'PWINO': 'Precipitation identifier information not available', 'RVRNO': 'Runway Visual Range missing', 'SLPNO': 'Sea level pressure not available', 'SOG': 'Snow on the ground', 'TSNO': 'Thunderstorm information not available'}

Static remarks translation elements

REMARKS_GROUPS = {'ACFT MSHP': 'Aircraft mishap'}

Static remarks translation groups