UNPKG

flight-planner

Version:

Plan and route VFR flights

115 lines (114 loc) 4.51 kB
import { FlightRules, ICAO } from './index.js'; /** * Represents a METAR (Meteorological Aerodrome Report) station. * * @interface MetarStation * @property {ICAO} station - The ICAO identifier for the METAR station. * @property {Metar} metar - The METAR data associated with the station. * @property {GeoJSON.Position} coords - The geographical coordinates of the station. */ export interface MetarStation { station: ICAO; metar: Metar; coords: GeoJSON.Position; } /** * Represents a distance measurement. * * @interface Distance * @property {number} value - The numerical value of the distance. * @property {'m'|'sm'} unit - The unit of measurement, either meters ('m') or statute miles ('sm'). */ export interface Distance { value: number; unit: 'm' | 'sm'; } /** * Represents atmospheric pressure information. * * @interface Pressure * @property {number} value - The numeric value of the pressure measurement * @property {'hPa' | 'inHg'} unit - The unit of measurement for pressure, either hectopascals (hPa) or inches of mercury (inHg) */ interface Pressure { value: number; unit: 'hPa' | 'inHg'; } /** * Represents cloud information. * * @interface Cloud * @property {'SKC' | 'FEW' | 'BKN' | 'SCT' | 'OVC' | 'NSC'} quantity - The cloud coverage quantity. * @property {number} [height] - The height of the cloud layer in feet (optional). */ export interface Cloud { quantity: 'SKC' | 'FEW' | 'BKN' | 'SCT' | 'OVC' | 'NSC'; height?: number; } /** * Represents wind conditions. * * @interface Wind * @property {number} direction - The direction of the wind in degrees (0-359). * @property {number} [directionMin] - The minimum wind direction in degrees (optional). * @property {number} [directionMax] - The maximum wind direction in degrees (optional). * @property {number} speed - The speed of the wind in knots. * @property {number} [gust] - The gust speed in knots (optional). */ export interface Wind { direction: number; directionMin?: number; directionMax?: number; speed: number; gust?: number; } /** * Creates a Metar object from a raw METAR string. * * @param raw The raw METAR string * @returns A Metar object */ export declare function createMetarFromString(raw: string): Metar; /** * Interface representing METAR (Meteorological Terminal Aviation Routine Weather Report) data. * * Contains parsed weather data from a METAR report, including station identification, * observation time, flight rules category, and various weather parameters. * * @interface Metar * @property {string} station - The ICAO code of the reporting station * @property {Date} observationTime - The date and time when the observation was made * @property {string} raw - The raw METAR text string * @property {number} [windDirection] - Wind direction in degrees * @property {number} [windDirectionMin] - Minimum wind direction in degrees (for variable wind direction) * @property {number} [windDirectionMax] - Maximum wind direction in degrees (for variable wind direction) * @property {number} [windSpeed] - Wind speed in the units used in the METAR (typically knots) * @property {number} [windGust] - Wind gust speed in the same units as windSpeed * @property {number} [temperature] - Temperature in degrees Celsius * @property {number} [dewpoint] - Dewpoint temperature in degrees Celsius * @property {number} [visibility] - Visibility in statute miles or meters (depends on country) * @property {number} [qnh] - Barometric pressure (QNH) in hPa or inHg (depends on country) * @property {Cloud[]} [clouds] - Array of cloud layers, each with a quantity and optional height */ export interface Metar { station: string; observationTime: Date; raw: string; wind: Wind; temperature?: number; dewpoint?: number; visibility?: Distance; qnh?: Pressure; clouds?: Cloud[]; } export declare function metarCeiling(metar: Metar): number | undefined; export declare function metarFlightRule(metar: Metar): FlightRules; export declare function isMetarExpired(metar: Metar, options?: { customMinutes?: number; useStandardRules?: boolean; }): boolean; export type MetarFlightRuleColor = 'green' | 'blue' | 'red' | 'purple' | 'black'; export declare function metarFlightRuleColor(metarData: Metar): MetarFlightRuleColor; export type MetarColorCode = 'green' | 'blue' | 'yellow' | 'amber' | 'red'; export declare function metarColorCode(metarData: Metar): MetarColorCode; export {};