@squawk
    Preparing search index...

    Function deriveFlightCategory

    • Derives the flight category (VFR, MVFR, IFR, LIFR) from visibility and ceiling conditions.

      The ceiling is defined as the lowest broken (BKN) or overcast (OVC) cloud layer, or vertical visibility if the sky is obscured. The flight category is determined by the most restrictive of ceiling or visibility.

      Category Ceiling Visibility
      VFR > 3,000 ft > 5 SM
      MVFR 1,000 - 3,000 ft 3 - 5 SM
      IFR 500 - 999 ft 1 - < 3 SM
      LIFR < 500 ft < 1 SM
      import { deriveFlightCategory } from '@squawk/weather';

      const category = deriveFlightCategory(10, false, { layers: [{ coverage: 'FEW', altitudeFtAgl: 25000 }] }, false);
      // Returns 'VFR'

      Parameters

      • visibilitySm: number | undefined

        Prevailing visibility in statute miles, or undefined if unknown.

      • isLessThan: boolean

        True when visibility is reported as less than the stated value.

      • sky: SkyCondition

        Sky condition with cloud layers and/or vertical visibility.

      • isCavok: boolean

        True when CAVOK is reported (implies VFR conditions).

      Returns FlightCategory | undefined

      The derived flight category, or undefined if insufficient data to determine.