UNPKG

flight-planner

Version:

Plan and route VFR flights

140 lines (139 loc) 4.97 kB
import { IMetar } from "metar-taf-parser"; /** * Enumeration representing different flight rules categories. * * @enum {string} * @readonly * @property {string} VFR - Visual Flight Rules * @property {string} MVFR - Marginal Visual Flight Rules * @property {string} IFR - Instrument Flight Rules * @property {string} LIFR - Low Instrument Flight Rules */ export declare enum FlightRules { VFR = "VFR", MVFR = "MVFR", IFR = "IFR", LIFR = "LIFR" } /** * 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'). */ 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'; } /** * 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 MetarData * @property {string} station - The ICAO code of the reporting station * @property {Date} observationTime - The date and time when the observation was made * @property {FlightRules} flightRules - The flight rules category (VFR, MVFR, IFR, LIFR) * @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 {number} [ceiling] - Height of the lowest broken or overcast cloud layer in feet */ export interface MetarData { station: string; observationTime: Date; flightRules: FlightRules; raw: string; windDirection?: number; windDirectionMin?: number; windDirectionMax?: number; windSpeed?: number; windGust?: number; temperature?: number; dewpoint?: number; visibility?: Distance; qnh?: Pressure; ceiling?: number; } /** * Converts a METAR object to a MetarData object. * * @param metar The METAR object * @returns The MetarData object */ export declare function fromIMetar(metar: IMetar): MetarData; /** * Converts a MetarData object to a METAR string. * * @param metarData The MetarData object * @returns The METAR string */ export declare function formatWind(metarData: MetarData): string; /** * Converts a MetarData object to a METAR string. * * @param metarData The MetarData object * @returns The METAR string */ export declare function formatTemperature(metarData: MetarData): string; /** * Converts a MetarData object to a METAR string. * * @param metarData The MetarData object * @returns The METAR string */ export declare function formatDewpoint(metarData: MetarData): string; /** * Converts a MetarData object to a METAR string. * * @param metarData The MetarData object * @returns The METAR string */ export declare function formatVisibility(metarData: MetarData): string; /** * Converts a MetarData object to a METAR string. * * @param metarData The MetarData object * @returns The METAR string */ export declare function formatQNH(metarData: MetarData): string; /** * Converts a MetarData object to a METAR string. * * @param metarData The MetarData object * @returns The METAR string */ export declare function formatCeiling(metarData: MetarData): string; /** * Returns a color string corresponding to the given flight rules. * * @param flightRules - The flight rules to convert to a color * @returns A string representing the color associated with the flight rules: * - 'green' for VFR (Visual Flight Rules) * - 'blue' for MVFR (Marginal Visual Flight Rules) * - 'red' for IFR (Instrument Flight Rules) * - 'purple' for LIFR (Low Instrument Flight Rules) * - 'black' for any undefined flight rules */ export declare function colorizeFlightRules(flightRules: FlightRules): string; export {};