A Wind instance represents surface wind conditions. The conditions are set using a METAR-style wind direction string (e.g. "180V210") and wind speed string (e.g. "10G15"). These can be set using the setDirection() or setSpeed() methods. These strings can also be retrieved directly from an airport-related page using the setFromPage() method. Other instance methods will return the windo components with respect to a particular runway magnetic heading. Here are some examples:
// create a Wind instance from the departure page settings.
const wind = new Wind('dep');
// find the crosswind on runway 7
const crosswind = wind.crosswind(70);
// find the headwind on runway 7
const headwind = wind.headwind(70);
The computed headwind and crosswind are worst-case: The higher wind gust speed is used, if present and if the winds are variable, the direction that produces the lowest headwind or largest crosswind is used.
Remember that METAR wind directions are always relative to true north and that a local magnetic variance value must be supplied.
If the Wind instance is set from a METAR-style wind specification string that is invalid, the instance has a dirErrorMsg and a speedErrorMsg property that each contains a message string explaining the reason for the error.
new Wind()
new Wind(pageId)
Constructs a new Wind instance. If a pageId string is provided, the instance is initialized from the information on the Page specified by pageId. See the setFromPage() method.
pageIdclone () {
clone()clone()
Return a new Wind instance that has the same wind settings as this instance.
A Wind instance.
crosswind()crosswind(magHeading)
Returns the worst-case (highest) crosswind component for this runway. Positive numbers are from the right, negative numbers are from the left.
magHeadingA headwind speed in knots.
components()components(magHeading)
Returns the wind components for this runway magnetic heading. The returned value is an object with min and max properties, each containing an array with four elements, with the following values in clockwise order: headwind, right crosswind, tailwind, and left crosswind. The max property is computed using the gust speed, and the min property is computed using the base wind speed.
If the wind comes from a steady direction, then the headwind and tailwind values will always be the same absolute value but with opposite signs, and similarly, the right and left crosswind will always be the same absolute value but with opposite signs.
If the wind direction is variable ('VRB'), then all min values are the base wind speed value, and all max values are the gust wind speed value.
If the wind is shifting between two directions (e.g., 010V040), then it's a bit more complicated. The min values are the minimum wind speed possible in that quadrant for a wind direction within the angular limits and the base wind speed. The max values are the maximum wind speed possible in that quadrant for a wind direction within the angular limits and the gust wind speed.
magHeadingAn object containing min and max properties. Each property contains an array of four numeric values, ordered clockwise around the four quadrants, as follows:
headwind()headwind(magHeading)
Returns the worst-case (lowest) headwind component for this runway. Positive numbers are headwinds, and negative numbers are tailwinds. A positive result is computed using the smaller base wind speed, while a negative result uses the equal or higher gust wind speed.
magHeadingA headwind speed in knots.
isValid()isValid()
Return true if both the wind speed and direction are valid.
A Booleans.
setDirection()setDirection(spec)
setDirection(spec, magVar)
Sets the instance's wind direction from the spec string. The string may be relative to magnetic north (an ATIS value) or true north (a METAR value). If the value is relative to true north, then a local magnetic variance must be provided.
specmagVar (optional)setFromPage (pageId) {
setFromPage()setFromPage(pageId)
Sets the instance's wind direction and speed from an airport page specified by pageId. The values are retrieved from the following page state variables:
${pageId}windSpeed_kt: The wind speed spec string in knots.${pageId}windDir_M: The wind direction spec string relative to magnetic north.pageId'alt': The alternate airport page'dep': The departure airport page'depRtn': The departure return airport page'dest': The destination airport pagesetSpeed()setSpeed(spec)
setSpeed(spec, units)
Sets the instance's wind speed from the spec string. If the wind speed is in units other than knots (e.g., "mps") then the units string must be provided and the wind speec value are converted to knots internally.
specunits (optional)dir1A wind direction in degrees relative to magnetic north. If the winds are variable without a range, then the value is the string 'VRB'. Read-only.
dir2A wind direction in degrees relative to magnetic north. If the winds are variable without a range, then the value is the string 'VRB'. If dir2 differs from dir1, then dir2 represents the angle clockwise from dir1 through which the wind varies. Read-only.
dirErrorMsgAn error message string for errors in the wind direction specification string. Read-only.
dirSpecThe wind direction string used to set the direction values. Read-only.
maxThe maximum (gust) wind speed in knots. Read-only.
magVarThe magnetic variance in degrees. The magVar value is added to a magnetic north direction to convert to true north. Read-only.
minThe base wind speed in knots. Read-only.
speedErrorMsgAn error message string for errors in the wind speed specification string. Read-only.
speedSpecThe wind speed string used to set the speed values. Read-only.
speedUnits
speedUnitsThe wind speed units string for the speedSpec. Read-only.