Skip to content

Instantly share code, notes, and snippets.

@centralhardware
Created February 22, 2024 19:09
Show Gist options
  • Save centralhardware/349246649369e6713845e25ed1c3ccd6 to your computer and use it in GitHub Desktop.
Save centralhardware/349246649369e6713845e25ed1c3ccd6 to your computer and use it in GitHub Desktop.
fun getMetar(icao: String): String{
val metar = metarService.retrieveFromAirport(icao)
return """
${getAirport(metar.airport)}
${metar.day} ${metar.time}
temp: ${metar.temperature}, dew point: ${metar.dewPoint}, ${if (metar.isNosig == true) "nosig" else ""}
${getWind(metar.wind)}
${getVisibility(metar.visibility)}
${getWeatherConditions(metar.weatherConditions)}
${metar.message}
""".trimIndent()
}
fun getTaf(icao: String): String{
val taf = tafService.retrieveFromAirport(icao)
val validity = taf.validity
return """
${getAirport(taf.airport)}
${validity.startDay}d ${validity.startHour}h - ${validity.endDay}d ${validity.endHour}h
${getWind(taf.wind)}
${getVisibility(taf.visibility)}
${getWeatherConditions(taf.weatherConditions)}
${taf.message}
""".trimIndent()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment