Skip to content

Weather API

Access via weather object in onTick context. Wind affects aircraft ground speed - headwinds reduce GS, tailwinds increase it.

weather.windAt(altitude)

Get wind at specified altitude.

Parameters:

  • altitude: number - Altitude in feet

Returns: {dirDeg: number, kts: number} - Direction wind is FROM and speed

Example:

javascript
onTick(({ weather, traffic }) => {
  const wind35000 = weather.windAt(35000);
  log(`Wind at FL350: ${wind35000.dirDeg}° at ${wind35000.kts}kts`);

  // Calculate headwind component for aircraft
  traffic.all().forEach(ac => {
    const wind = weather.windAt(ac.altFt);
    const hdgRad = (ac.hdgDeg * Math.PI) / 180;
    const windRad = (wind.dirDeg * Math.PI) / 180;
    const headwind = wind.kts * Math.cos(windRad - hdgRad);
    log(`${ac.cs} headwind: ${headwind.toFixed(0)}kts`);
  });
});

weather.surfaceWind()

Get surface wind (used for runway selection).

Returns: {dirDeg: number, kts: number}

Example:

javascript
onTick(({ weather }) => {
  const sfc = weather.surfaceWind();
  log(`Surface wind: ${sfc.dirDeg}° at ${sfc.kts}kts`);
});

weather.cells()

Get all active weather cells (thunderstorms).

Returns: WeatherCell[]

javascript
{
  id: string,            // Unique cell ID
  center: {lat, lon},    // Geographic position
  radiusNm: number,      // Cell radius in nautical miles
  intensity: string      // "light" | "moderate" | "heavy" | "extreme"
}

Example:

javascript
onTick(({ weather, traffic }) => {
  const cells = weather.cells();
  log(`Active weather cells: ${cells.length}`);

  cells.forEach(cell => {
    if (cell.intensity === 'extreme') {
      log(`Severe weather at ${cell.center.lat.toFixed(2)}, ${cell.center.lon.toFixed(2)}`);
    }
  });
});

weather.intensity()

Get current weather intensity setting (0-100).

Returns: number

Example:

javascript
onTick(({ weather }) => {
  const intensity = weather.intensity();
  if (intensity > 50) {
    log("Heavy weather conditions - expect deviations");
  }
});