### Install dependency for Kotlin up to 2.1.20 Source: https://github.com/alexmaryin/metarkt/blob/master/README.md Dependency configuration for projects using Kotlin versions up to 2.1.20. ```xml io.github.alexmaryin.metarkt parser 1.0.1 ``` ```groovy implementation 'io.github.alexmaryin.metarkt:parser:1.0.1' ``` ```kotlin implementation("io.github.alexmaryin.metarkt:parser:1.0.1") ``` -------------------------------- ### Install dependency for Kotlin 2.2.0+ Source: https://github.com/alexmaryin/metarkt/blob/master/README.md Dependency configuration for projects using Kotlin 2.2.0 or newer. ```xml io.github.alexmaryin.metarkt metarkt 1.2.1 ``` ```groovy implementation 'io.github.alexmaryin.metarkt:metarkt:1.2.1' ``` ```kotlin implementation("io.github.alexmaryin.parser:metarkt:1.2.1") ``` -------------------------------- ### Convert QFE to QNH with Temperature Correction Source: https://context7.com/alexmaryin/metarkt/llms.txt Converts QFE to QNH, accounting for actual atmospheric temperature for more accurate pressure calculations. Provides examples for both standard and cold temperature scenarios. ```kotlin import alexmaryin.metarkt.models.PressureQFE import alexmaryin.metarkt.helpers.toCorrectedQnh // Airport at 100 meters, QFE 750 mmHg, temperature 25°C val qfe = PressureQFE(mmHg = 750) val elevation = 100 // meters val temperature = 25 // Celsius val correctedQnh = qfe.toCorrectedQnh(elevation, temperature) println("QNH (corrected): $correctedQnh hPa") // 1011 hPa // Cold temperature example (affects pressure calculation) val coldQnh = qfe.toCorrectedQnh(elevation, -20) println("QNH (cold): $coldQnh hPa") // Compare ISA vs corrected at various temperatures val qfeTest = PressureQFE(mmHg = 755) val elev = 200 // meters println("ISA QNH: ${qfeTest.toIsaQnh(elev)} hPa") println("At +30°C: ${qfeTest.toCorrectedQnh(elev, 30)} hPa") println("At -30°C: ${qfeTest.toCorrectedQnh(elev, -30)} hPa") ``` -------------------------------- ### Parse Ground Level Pressure (QFE) Source: https://context7.com/alexmaryin/metarkt/llms.txt Extract QFE pressure from METAR remarks or create instances from mmHg, with automatic conversion to hPa. ```kotlin import alexmaryin.metarkt.MetarParser import alexmaryin.metarkt.models.PressureQFE val parser = MetarParser.current() // Parse QFE from METAR (RMK section) val metar = parser.parse("UWLL 251200Z 16008MPS 8000 -SN OVC013 M09/M13 Q1008 RMK QFE746/0994") val qfe = metar.pressureQFE if (qfe != null) { println("mmHg: ${qfe.mmHg}") // 746 mmHg println("hPa: ${qfe.milliBar}") // 994 hPa } // Create QFE from mmHg (auto-converts to hPa) val qfeFromMm = PressureQFE(mmHg = 760) println("${qfeFromMm.mmHg} mmHg = ${qfeFromMm.milliBar} hPa") // Standard atmosphere at ground level val standard = PressureQFE.standard() // 760 mmHg = 1013 hPa println("Standard: ${standard.mmHg} mmHg / ${standard.milliBar} hPa") ``` -------------------------------- ### Parse Sea Level Pressure (QNH) Source: https://context7.com/alexmaryin/metarkt/llms.txt Handle QNH pressure values in hPa or inHg and perform conversions between units. ```kotlin import alexmaryin.metarkt.MetarParser import alexmaryin.metarkt.models.PressureQNH val parser = MetarParser.current() // Pressure in hectopascals (Q prefix - international) val metarHpa = parser.parse("UWLL 231100Z 20002MPS 9999 BKN030 M22/M26 Q1012") val pressureHpa = metarHpa.pressureQNH!! println("hPa: ${pressureHpa.hPa}") // 1012 hPa println("inHg: ${pressureHpa.inHg}") // 29.88 inHg // Pressure in inches of mercury (A prefix - US) val metarInHg = parser.parse("KLAX 231053Z 35005KT 10SM FEW006 14/11 A3003") val pressureInHg = metarInHg.pressureQNH!! println("hPa: ${pressureInHg.hPa}") // 1017 hPa println("inHg: ${pressureInHg.inHg}") // 30.03 inHg // Create pressure from hPa (auto-converts to inHg) val fromHpa = PressureQNH.fromHpa(1013) println("${fromHpa.hPa} hPa = ${fromHpa.inHg} inHg") // Create pressure from inHg (auto-converts to hPa) val fromInHg = PressureQNH.fromInHg(29.92f) println("${fromInHg.inHg} inHg = ${fromInHg.hPa} hPa") // Standard atmosphere pressure val standard = PressureQNH.standard() // 1013 hPa = 29.92 inHg println("Standard: ${standard.hPa} hPa / ${standard.inHg} inHg") ``` -------------------------------- ### Parse Temperature and Dew Point Source: https://context7.com/alexmaryin/metarkt/llms.txt Extract air temperature and dew point values, handling positive, negative, and freezing conditions. ```kotlin import alexmaryin.metarkt.MetarParser import alexmaryin.metarkt.models.Temperature val parser = MetarParser.current() // Positive temperatures val warmMetar = parser.parse("KLAX 231053Z 35005KT 10SM FEW006 14/11 A3003") val warmTemp = warmMetar.temperature!! println("Air: ${warmTemp.air}°C") // 14°C println("Dew Point: ${warmTemp.dewPoint}°C") // 11°C // Negative temperatures (M prefix in METAR = minus) val coldMetar = parser.parse("UEEE 161500Z 00000MPS 0150NE FG VV003 M57/M60 Q1038") val coldTemp = coldMetar.temperature!! println("Air: ${coldTemp.air}°C") // -57°C println("Dew Point: ${coldTemp.dewPoint}°C") // -60°C // Freezing temperature val freezingMetar = parser.parse("LOWI 231120Z VRB02KT CAVOK 00/M07 Q1018") val freezingTemp = freezingMetar.temperature!! println("Air: ${freezingTemp.air}°C") // 0°C println("Dew Point: ${freezingTemp.dewPoint}°C") // -7°C ``` -------------------------------- ### Handle Wind Information and Conversions Source: https://context7.com/alexmaryin/metarkt/llms.txt Extract wind details such as gusts and variable directions, and perform automatic unit conversions between knots, MPS, and KPH. ```kotlin import alexmaryin.metarkt.MetarParser import alexmaryin.metarkt.models.Wind import alexmaryin.metarkt.models.WindUnit val parser = MetarParser.current() // Parse METAR with gusty winds val metar = parser.parse("ULLI 231100Z 24007G12MPS 200V290 9000 BKN014 OVC032 M03/M06 Q0998") val wind = metar.wind!! println("Direction: ${wind.direction}°") // 240° println("Variable: ${wind.variable}") // false println("Speed: ${wind.speed} ${wind.speedUnits}") // 7 MPS println("Gusts: ${wind.gusts}") // 12 println("Is Calm: ${wind.isCalm}") // false // Speed conversions println("Speed in Knots: ${wind.speedKt} kt") // 14 kt println("Speed in MPS: ${wind.speedMps} m/s") // 7 m/s println("Gusts in Knots: ${wind.gustsKt} kt") // 23 kt println("Gusts in MPS: ${wind.gustsMps} m/s") // 12 m/s // Variable wind example val varWindMetar = parser.parse("LOWI 231120Z VRB02KT CAVOK 00/M07 Q1018") val varWind = varWindMetar.wind!! println("Variable wind: ${varWind.variable}") // true println("Speed: ${varWind.speed} ${varWind.speedUnits}") // 2 KT // Calm wind example val calmMetar = parser.parse("KORD 231451Z 00000KT 10SM CLR 12/M03 A3024") val calmWind = calmMetar.wind!! println("Is Calm: ${calmWind.isCalm}") // true ``` -------------------------------- ### Access Parsed Weather Data Components Source: https://context7.com/alexmaryin/metarkt/llms.txt The result object provides access to all parsed METAR components, including lists for weather phenomena and cloud layers. ```kotlin import alexmaryin.metarkt.MetarParser import alexmaryin.metarkt.models.* val parser = MetarParser.current() // Parse METAR from Los Angeles International Airport val metar = parser.parse("KLAX 231053Z 35005KT 10SM FEW006 BKN040 OVC070 14/11 A3003") // Access all parsed components val station: String? = metar.station // "KLAX" val reportTime: LocalDateTime? = metar.reportTime // Parsed datetime val wind: Wind? = metar.wind // Wind data val visibility: Visibility? = metar.visibility // Visibility data val phenomenons: List = metar.phenomenons // Weather phenomena val clouds: List = metar.clouds // Cloud layers sorted by altitude val temperature: Temperature? = metar.temperature // Air temp and dew point val pressureQNH: PressureQNH? = metar.pressureQNH // Sea level pressure val pressureQFE: PressureQFE? = metar.pressureQFE // Ground level pressure val cavok: Boolean = metar.ceilingAndVisibilityOK // CAVOK status val raw: String = metar.raw // Original METAR string ``` -------------------------------- ### Parse Visibility Information Source: https://context7.com/alexmaryin/metarkt/llms.txt Extracts visibility distance, units, directional visibility, and RVR from METAR strings. Handles standard meters, statute miles, and CAVOK conditions. ```kotlin import alexmaryin.metarkt.MetarParser import alexmaryin.metarkt.models.VisibilityUnit import alexmaryin.metarkt.models.VisibilityDirection val parser = MetarParser.current() // Standard visibility in meters val metar1 = parser.parse("UWLL 231100Z 20002MPS 9999 BKN030 M22/M26 Q1012") val vis1 = metar1.visibility!! println("Distance: ${vis1.distAll} ${vis1.distUnits}") // 9999 METERS // Visibility in statute miles (US airports) val metar2 = parser.parse("KLAX 231053Z 35005KT 10SM FEW006 BKN040 14/11 A3003") val vis2 = metar2.visibility!! println("Distance: ${vis2.distAll} ${vis2.distUnits}") // 10 SM // CAVOK (Ceiling And Visibility OK) val metar3 = parser.parse("LOWI 231120Z VRB02KT CAVOK 00/M07 Q1018") val vis3 = metar3.visibility!! println("CAVOK Distance: ${vis3.distAll}") // 9999 (unlimited) println("CAVOK Status: ${metar3.ceilingAndVisibilityOK}") // true // Directional visibility and RVR val metar4 = parser.parse("UEEE 161500Z 00000MPS 0150NE 0250NW R23L/0450 FG VV003 M57/M60 Q1038") val vis4 = metar4.visibility!! println("By Directions:") vis4.byDirections.forEach { dir -> println(" ${dir.direction}: ${dir.dist}m") // NORTH_EAST: 150m, NORTH_WEST: 250m } println("By Runways:") vis4.byRunways.forEach { rwy -> println(" Runway ${rwy.runway}: ${rwy.dist}m") // Runway 23L: 450m } ``` -------------------------------- ### Identify Weather Phenomena Source: https://context7.com/alexmaryin/metarkt/llms.txt Parses weather phenomena groups and intensity levels from METAR reports. Intensity levels are categorized as NONE, HIGH (+), or LIGHT (-). ```kotlin import alexmaryin.metarkt.MetarParser import alexmaryin.metarkt.models.Phenomenons import alexmaryin.metarkt.models.PhenomenonIntensity val parser = MetarParser.current() // Light snow showers with blowing snow val metar = parser.parse("ULLI 231100Z 24007G12MPS 9000 -SHSN DRSN BKN014CB OVC032 M03/M06 Q0998") val phenomena = metar.phenomenons phenomena.forEach { phenomenon -> println("Intensity: ${phenomenon.intensity}") // LIGHT, NONE println("Types: ${phenomenon.group}") // [SHOWER, SNOW], [DRIFTING, SNOW] } // Available phenomenon types: // DRIZZLE(DZ), RAIN(RA), SNOW(SN), SNOW_GRAINS(SG), ICE_PELLETS(PL), SMALL_HAIL(GS), // HAIL(GR), SHOWER(SH), FREEZE(FZ), THUNDERSTORM(TS), DUST_STORM(DS), SANDSTORM(SS), // FOG(FG), IN_VICINITY(VC), SHALLOW(MI), PARTIAL(PR), PATCHES(BC), MIST(BR), // HAZE(HZ), SMOKE(FU), DUST(DU), BLOWING(BL), SQUALL(SQ), ICE_CRYSTALS(IC), // VOLCANIC_ASH(VA), DRIFTING(DR), SAND(SA) // Intensity levels: NONE, HIGH (+), LIGHT (-) val fogMetar = parser.parse("UEEE 161500Z 00000MPS 0150NE FG VV003 M57/M60 Q1038") fogMetar.phenomenons.forEach { p -> println("Fog intensity: ${p.intensity}") // NONE (no modifier) println("Contains FOG: ${Phenomenons.FOG in p.group}") // true } ``` -------------------------------- ### Calculate Wind Components for Runway Source: https://github.com/alexmaryin/metarkt/blob/master/README.md Calculates headwind and crosswind components based on wind direction, speed, and runway true course. ```kotlin val wind = Wind(direction = 225, speed = 10, speedUnits = WindUnit.KT) val runway = 180 // true course not magnetic! val component = wind.componentForRunwayTrue(runway) ``` ```kotlin data class WindComponent( val headwind: Double, // positive = headwind, negative = tailwind val crosswind: Double, // always positive magnitude val fromLeft: Boolean // true if crosswind comes from the left ) ``` -------------------------------- ### Parse Cloud Layer Information Source: https://context7.com/alexmaryin/metarkt/llms.txt Access cloud layer details including altitude, type, and cumulus classification from a parsed METAR string. ```kotlin import alexmaryin.metarkt.MetarParser import alexmaryin.metarkt.models.CloudsType import alexmaryin.metarkt.models.CumulusType val parser = MetarParser.current() // Multiple cloud layers val metar = parser.parse("KLAX 231053Z 35005KT 10SM FEW006 BKN040 OVC070 14/11 A3003") val clouds = metar.clouds // Sorted by altitude clouds.forEach { layer -> println("Type: ${layer.type}") // FEW, BROKEN, OVERCAST println("Base: ${layer.lowMarginFt * 100} ft") // 600, 4000, 7000 ft println("Cumulus: ${layer.cumulusType}") // null (no CB or TCU) } // Cumulonimbus clouds (CB) val cbMetar = parser.parse("ULLI 231100Z 24007G12MPS 9000 BKN014CB OVC032 M03/M06 Q0998") cbMetar.clouds.forEach { layer -> if (layer.cumulusType == CumulusType.CUMULONIMBUS) { println("CB at ${layer.lowMarginFt * 100} ft") // CB at 1400 ft } } // Cloud types: CLEAR(SKC), NIL_SIGNIFICANT(NSC), FEW, SCATTERED(SCT), BROKEN(BKN), OVERCAST(OVC) // Cumulus types: CUMULONIMBUS(CB), TOWERING_CUMULUS(TCU) ``` -------------------------------- ### Calculate Cold Temperature Corrections in Kotlin Source: https://github.com/alexmaryin/metarkt/blob/master/README.md Use calculateColdTemperatureCorrections to determine altitude adjustments for instrument approach segments. Set roundUpForSafety to true to comply with standard safety practices for final segments. ```kotlin val fafAltitude = 2000 // FAF published altitude (MSL) val mdaAltitude = 1500 // MDA/DA published altitude (MSL) val airportElevation = 200 // airport elevation (MSL) val temperature = -20 // celsius val corrections = calculateColdTemperatureCorrections( fafAltitude = fafAltitude, mdaAltitude = mdaAltitude, airportElevation = airportElevation, reportedTemperatureC = temperature, roundUpForSafety = true // recommended: rounds up to next table value for final segment ) // Apply corrections to published altitudes val correctedFaf = corrections.correctIntermediateSegment(fafAltitude) val correctedMda = corrections.correctFinalSegment(mdaAltitude) ``` -------------------------------- ### Convert QFE to QNH Source: https://github.com/alexmaryin/metarkt/blob/master/README.md Converts ground level pressure (QFE) to sea level pressure (QNH) using either standard atmosphere or temperature-corrected calculations. ```kotlin val qfe = PressureQFE(mmHg = 750) val elevation = 100 // meters val actualQnh = qfe.toIsaQnh(elevation) // return 1011 ``` ```kotlin val qfe = PressureQFE(mmHg = 750) val elevation = 100 // meters val temperature = 25 // celsius val actualQnh = qfe.toCorrectedQnh(elevation, temperature) // return 1011 ``` -------------------------------- ### Parse METAR String with MetarParser Source: https://context7.com/alexmaryin/metarkt/llms.txt Use the MetarParser interface to convert raw METAR strings into structured data. Access individual components like station, wind, and pressure directly from the resulting object. ```kotlin import alexmaryin.metarkt.MetarParser val parser = MetarParser.current() // Parse a METAR from Ulyanovsk Central Airport val metar = parser.parse("UWLL 251200Z 16008MPS 8000 -SN BLSN OVC013 M09/M13 Q1008 R20/820242 NOSIG RMK QFE746/0994") println("Station: ${metar.station}") // UWLL println("Report Time: ${metar.reportTime}") // 2024-XX-25T12:00:00 println("Wind: ${metar.wind?.direction}° at ${metar.wind?.speed} ${metar.wind?.speedUnits}") // 160° at 8 MPS println("Visibility: ${metar.visibility?.distAll}m") // 8000m println("Temperature: ${metar.temperature?.air}°C, Dew Point: ${metar.temperature?.dewPoint}°C") // -9°C, -13°C println("Pressure QNH: ${metar.pressureQNH?.hPa} hPa") // 1008 hPa println("CAVOK: ${metar.ceilingAndVisibilityOK}") // false println("Raw: ${metar.raw}") ``` -------------------------------- ### PressureQFE.toCorrectedQnh Source: https://context7.com/alexmaryin/metarkt/llms.txt Converts QFE to QNH accounting for actual atmospheric temperature, providing more accurate pressure calculations. ```APIDOC ## PressureQFE.toCorrectedQnh - Convert QFE to QNH (Temperature Corrected) ### Description Converts QFE to QNH accounting for actual atmospheric temperature, providing more accurate pressure calculations. ### Method Extension Function (Kotlin) ### Endpoint N/A (Local function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin import alexmaryin.metarkt.models.PressureQFE import alexmaryin.metarkt.helpers.toCorrectedQnh // Airport at 100 meters, QFE 750 mmHg, temperature 25°C val qfe = PressureQFE(mmHg = 750) val elevation = 100 // meters val temperature = 25 // Celsius val correctedQnh = qfe.toCorrectedQnh(elevation, temperature) println("QNH (corrected): $correctedQnh hPa") // 1011 hPa // Cold temperature example (affects pressure calculation) val coldQnh = qfe.toCorrectedQnh(elevation, -20) println("QNH (cold): $coldQnh hPa") // Compare ISA vs corrected at various temperatures val qfeTest = PressureQFE(mmHg = 755) val elev = 200 // meters println("ISA QNH: ${qfeTest.toIsaQnh(elev)} hPa") println("At +30°C: ${qfeTest.toCorrectedQnh(elev, 30)} hPa") println("At -30°C: ${qfeTest.toCorrectedQnh(elev, -30)} hPa") ``` ### Response #### Success Response (200) Returns the calculated corrected QNH value in hectopascals (hPa). #### Response Example ``` 1011 hPa ``` ``` -------------------------------- ### Apply Cold Temperature Altitude Correction Source: https://github.com/alexmaryin/metarkt/blob/master/README.md Calculates corrected altitude for cold temperatures based on height above airport elevation. ```kotlin val indicatedHeight = 1500 // feet above airport val temperature = -20 // celsius val correctedHeight = coldTemperatureCorrectedAltitude(indicatedHeight, temperature) // return 1710 ``` -------------------------------- ### Calculate Segment-Based Cold Temperature Corrections for Approaches Source: https://context7.com/alexmaryin/metarkt/llms.txt Calculates cold temperature corrections for instrument approaches using the FAA segment-based method (AIM 7-3-6). It provides separate corrections for intermediate and final segments and allows for safety rounding up. Supports applying corrections to published altitudes. ```kotlin import alexmaryin.metarkt.helpers.calculateColdTemperatureCorrections import alexmaryin.metarkt.helpers.ColdTemperatureCorrections // ILS approach with: // FAF at 2000 ft MSL, MDA at 1500 ft MSL, airport at 200 ft MSL val fafAltitude = 2000 // FAF published altitude (MSL) val mdaAltitude = 1500 // MDA/DA published altitude (MSL) val airportElevation = 200 // Airport elevation (MSL) val temperature = -20 // Celsius val corrections = calculateColdTemperatureCorrections( fafAltitude = fafAltitude, mdaAltitude = mdaAltitude, airportElevation = airportElevation, reportedTemperatureC = temperature, roundUpForSafety = true // Recommended: rounds up for final segment ) // Access correction values println("Intermediate segment correction: +${corrections.intermediateSegmentCorrection} ft") println("Final segment correction: +${corrections.finalSegmentCorrection} ft") println("FAF height above airport: ${corrections.fafHeightAboveAirport} ft") println("MDA height above airport: ${corrections.mdaHeightAboveAirport} ft") println("MDA height (rounded): ${corrections.mdaHeightAboveAirportRounded} ft") // Apply corrections to published altitudes val correctedFaf = corrections.correctIntermediateSegment(fafAltitude) val correctedMda = corrections.correctFinalSegment(mdaAltitude) println("Original FAF: $fafAltitude ft -> Corrected: $correctedFaf ft") println("Original MDA: $mdaAltitude ft -> Corrected: $correctedMda ft") // Apply same intermediate correction to stepdown fixes val stepdownFix = 1800 // ft MSL val correctedStepdown = corrections.correctIntermediateSegment(stepdownFix) println("Stepdown fix: $stepdownFix ft -> Corrected: $correctedStepdown ft") ``` -------------------------------- ### Convert QFE to QNH using ISA Source: https://context7.com/alexmaryin/metarkt/llms.txt Converts ground level pressure (QFE) to sea level pressure (QNH) using International Standard Atmosphere (ISA) calculations. Pressure is rounded down to the nearest whole hectopascal as per ICAO standards. ```kotlin import alexmaryin.metarkt.models.PressureQFE import alexmaryin.metarkt.helpers.toIsaQnh // Airport at 100 meters elevation with QFE of 750 mmHg val qfe = PressureQFE(mmHg = 750) val elevation = 100 // meters above sea level val qnh = qfe.toIsaQnh(elevation) println("QNH (ISA): $qnh hPa") // 1011 hPa // Per ICAO DOC 8896, pressure is rounded DOWN to nearest whole hectopascal val qfe2 = PressureQFE(mmHg = 746) val qnh2 = qfe2.toIsaQnh(150) println("QNH (ISA): $qnh2 hPa") ``` -------------------------------- ### Calculate Wind Components for Runway Source: https://context7.com/alexmaryin/metarkt/llms.txt Calculates headwind, tailwind, and crosswind components for a specific runway heading. Ensure the runway heading is provided as a true course, not magnetic. ```kotlin import alexmaryin.metarkt.models.Wind import alexmaryin.metarkt.models.WindUnit import alexmaryin.metarkt.helpers.componentForRunwayTrue import alexmaryin.metarkt.helpers.WindComponent // Wind from 225° at 10 knots, runway 18 (180° true heading) val wind = Wind(direction = 225, speed = 10, speedUnits = WindUnit.KT) val runwayHeading = 180 // True course, not magnetic! val component: WindComponent = wind.componentForRunwayTrue(runwayHeading) println("Headwind: ${component.headwind}") // Positive = headwind, negative = tailwind println("Crosswind: ${component.crosswind}") // Always positive magnitude println("From Left: ${component.fromLeft}") // true if crosswind from left // Example: Wind from 270° at 15 knots for runway 27 (270°) val directWind = Wind(direction = 270, speed = 15, speedUnits = WindUnit.KT) val directComponent = directWind.componentForRunwayTrue(270) println("Direct headwind: ${directComponent.headwind}") // ~15 (pure headwind) println("Crosswind: ${directComponent.crosswind}") // ~0 (no crosswind) // Example: 90° crosswind from the right val crossWind = Wind(direction = 360, speed = 10, speedUnits = WindUnit.KT) val crossComponent = crossWind.componentForRunwayTrue(270) println("Headwind: ${crossComponent.headwind}") // ~0 println("Crosswind: ${crossComponent.crosswind}") // ~10 println("From Left: ${crossComponent.fromLeft}") // false (from right) ``` -------------------------------- ### Metar data class structure Source: https://github.com/alexmaryin/metarkt/blob/master/README.md The structure of the Metar data class returned by the parser. ```kotlin val station: String?, val reportTime: LocalDateTime?, val wind: Wind?, val visibility: Visibility?, val phenomenons: Phenomenons?, val clouds: List, val temperature: Temperature?, val pressureQNH: PressureQNH?, val pressureQFE: PressureQFE?, val ceilingAndVisibilityOK: Boolean, val raw: String ``` -------------------------------- ### calculateColdTemperatureCorrections Source: https://context7.com/alexmaryin/metarkt/llms.txt Calculates cold temperature corrections for instrument approaches using the FAA segment-based method. ```APIDOC ## calculateColdTemperatureCorrections - Segment-Based Approach Corrections ### Description Calculates cold temperature corrections for instrument approaches using the FAA segment-based method (AIM 7-3-6). ### Method Function (Kotlin) ### Endpoint N/A (Local function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin import alexmaryin.metarkt.helpers.calculateColdTemperatureCorrections import alexmaryin.metarkt.helpers.ColdTemperatureCorrections // ILS approach with: // FAF at 2000 ft MSL, MDA at 1500 ft MSL, airport at 200 ft MSL val fafAltitude = 2000 // FAF published altitude (MSL) val mdaAltitude = 1500 // MDA/DA published altitude (MSL) val airportElevation = 200 // Airport elevation (MSL) val temperature = -20 // Celsius val corrections = calculateColdTemperatureCorrections( fafAltitude = fafAltitude, mdaAltitude = mdaAltitude, airportElevation = airportElevation, reportedTemperatureC = temperature, roundUpForSafety = true // Recommended: rounds up for final segment ) // Access correction values println("Intermediate segment correction: +${corrections.intermediateSegmentCorrection} ft") println("Final segment correction: +${corrections.finalSegmentCorrection} ft") println("FAF height above airport: ${corrections.fafHeightAboveAirport} ft") println("MDA height above airport: ${corrections.mdaHeightAboveAirport} ft") println("MDA height (rounded): ${corrections.mdaHeightAboveAirportRounded} ft") // Apply corrections to published altitudes val correctedFaf = corrections.correctIntermediateSegment(fafAltitude) val correctedMda = corrections.correctFinalSegment(mdaAltitude) println("Original FAF: $fafAltitude ft -> Corrected: $correctedFaf ft") println("Original MDA: $mdaAltitude ft -> Corrected: $correctedMda ft") // Apply same intermediate correction to stepdown fixes val stepdownFix = 1800 // ft MSL val correctedStepdown = corrections.correctIntermediateSegment(stepdownFix) println("Stepdown fix: $stepdownFix ft -> Corrected: $correctedStepdown ft") ``` ### Response #### Success Response (200) Returns a `ColdTemperatureCorrections` object containing calculated correction values. #### Response Example ```json { "intermediateSegmentCorrection": 280, "finalSegmentCorrection": 280, "fafHeightAboveAirport": 1800, "mdaHeightAboveAirport": 1300, "mdaHeightAboveAirportRounded": 1300 } ``` ``` -------------------------------- ### PressureQFE.toIsaQnh Source: https://context7.com/alexmaryin/metarkt/llms.txt Converts ground level pressure (QFE) to sea level pressure (QNH) using International Standard Atmosphere calculations. ```APIDOC ## PressureQFE.toIsaQnh - Convert QFE to QNH (Standard Atmosphere) ### Description Converts ground level pressure (QFE) to sea level pressure (QNH) using International Standard Atmosphere calculations. ### Method Extension Function (Kotlin) ### Endpoint N/A (Local function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin import alexmaryin.metarkt.models.PressureQFE import alexmaryin.metarkt.helpers.toIsaQnh // Airport at 100 meters elevation with QFE of 750 mmHg val qfe = PressureQFE(mmHg = 750) val elevation = 100 // meters above sea level val qnh = qfe.toIsaQnh(elevation) println("QNH (ISA): $qnh hPa") // 1011 hPa // Per ICAO DOC 8896, pressure is rounded DOWN to nearest whole hectopascal val qfe2 = PressureQFE(mmHg = 746) val qnh2 = qfe2.toIsaQnh(150) println("QNH (ISA): $qnh2 hPa") ``` ### Response #### Success Response (200) Returns the calculated QNH value in hectopascals (hPa). #### Response Example ``` 1011 hPa ``` ``` -------------------------------- ### Apply Cold Temperature Altitude Correction Source: https://context7.com/alexmaryin/metarkt/llms.txt Applies FAA/ICAO cold temperature correction to an indicated altitude above airport elevation. The correction increases with lower temperatures and higher altitudes. Supports heights from 200 ft to 5000 ft and temperatures from +10°C to -50°C. ```kotlin import alexmaryin.metarkt.helpers.coldTemperatureCorrectedAltitude // Aircraft at 1500 ft above airport, temperature -20°C val indicatedHeight = 1500 // feet above airport val temperature = -20 // Celsius val correctedHeight = coldTemperatureCorrectedAltitude(indicatedHeight, temperature) println("Corrected altitude: $correctedHeight ft") // 1710 ft // The correction increases with lower temperatures and higher altitudes val corrections = listOf(-10, -20, -30, -40, -50).map { temp -> temp to coldTemperatureCorrectedAltitude(2000, temp) } corrections.forEach { (temp, alt) -> println("At $temp°C: $alt ft") } // At -10°C: 2200 ft // At -20°C: 2280 ft // At -30°C: 2380 ft // At -40°C: 2480 ft // At -50°C: 2590 ft // Supports heights from 200 ft to 5000 ft above airport // Supports temperatures from +10°C to -50°C ``` -------------------------------- ### coldTemperatureCorrectedAltitude Source: https://context7.com/alexmaryin/metarkt/llms.txt Applies FAA/ICAO cold temperature correction to an indicated altitude above airport elevation. ```APIDOC ## coldTemperatureCorrectedAltitude - Simple Altitude Correction ### Description Applies FAA/ICAO cold temperature correction to an indicated altitude above airport elevation. ### Method Function (Kotlin) ### Endpoint N/A (Local function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin import alexmaryin.metarkt.helpers.coldTemperatureCorrectedAltitude // Aircraft at 1500 ft above airport, temperature -20°C val indicatedHeight = 1500 // feet above airport val temperature = -20 // Celsius val correctedHeight = coldTemperatureCorrectedAltitude(indicatedHeight, temperature) println("Corrected altitude: $correctedHeight ft") // 1710 ft // The correction increases with lower temperatures and higher altitudes val corrections = listOf(-10, -20, -30, -40, -50).map { temp -> temp to coldTemperatureCorrectedAltitude(2000, temp) } corrections.forEach { (temp, alt) -> println("At $temp°C: $alt ft") } // At -10°C: 2200 ft // At -20°C: 2280 ft // At -30°C: 2380 ft // At -40°C: 2480 ft // At -50°C: 2590 ft // Supports heights from 200 ft to 5000 ft above airport // Supports temperatures from +10°C to -50°C ``` ### Response #### Success Response (200) Returns the corrected altitude in feet (ft). #### Response Example ``` 1710 ft ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.