* Use interpolated forecast data to update current weather data, refactor weather provider code * Fix interpolation between locations * Fix copypaste error message for open meteo http * Fix error display * Show interpolated time * Fix position forecasts after refactoring * fix #84: Add lerpAngle * fix #85: Fix weather widget shows wind direction rotated by 180 degrees * Make red background color slightly lighter to improve contrast
22 lines
806 B
Kotlin
22 lines
806 B
Kotlin
package de.timklge.karooheadwind.weatherprovider
|
|
|
|
enum class WeatherInterpretation {
|
|
CLEAR, CLOUDY, RAINY, SNOWY, DRIZZLE, THUNDERSTORM, UNKNOWN;
|
|
|
|
companion object {
|
|
// WMO weather interpretation codes (WW)
|
|
fun fromWeatherCode(code: Int?): WeatherInterpretation {
|
|
return when(code){
|
|
0 -> CLEAR
|
|
1, 2, 3 -> CLOUDY
|
|
45, 48, 61, 63, 65, 66, 67, 80, 81, 82 -> RAINY
|
|
71, 73, 75, 77, 85, 86 -> SNOWY
|
|
51, 53, 55, 56, 57 -> DRIZZLE
|
|
95, 96, 99 -> THUNDERSTORM
|
|
else -> UNKNOWN
|
|
}
|
|
}
|
|
|
|
fun getKnownWeatherCodes(): Set<Int> = setOf(0, 1, 2, 3, 45, 48, 61, 63, 65, 66, 67, 80, 81, 82, 71, 73, 75, 77, 85, 86, 51, 53, 55, 56, 57, 95, 96, 99)
|
|
}
|
|
} |