fix: WMOcode for openmeteo implmentation
This commit is contained in:
parent
288895f065
commit
dbd289762a
@ -44,18 +44,20 @@ public class OpenMeteo implements WeatherDataAPI {
|
|||||||
return JSONFetcher.fetch(url);
|
return JSONFetcher.fetch(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return condition based on the WMOCode
|
||||||
|
* table can be find here : https://open-meteo.com/en/docs (at the end)
|
||||||
|
* @param WMOCode id code
|
||||||
|
* @return weather condition
|
||||||
|
*/
|
||||||
private static Condition getConditionFromCode(int WMOCode) {
|
private static Condition getConditionFromCode(int WMOCode) {
|
||||||
// TODO Wesh Nemo c'est quoi cette merde ?
|
return switch (WMOCode) {
|
||||||
if (WMOCode == 2 )
|
case 0, 1 -> Condition.SUNNY;
|
||||||
return Condition.PARTIAL;
|
case 2 -> Condition.PARTIAL;
|
||||||
if (WMOCode < 20)
|
case 3 -> Condition.CLOUDY;
|
||||||
return Condition.SUNNY;
|
case 61, 63, 65, 80, 81, 82 -> Condition.RAINY;
|
||||||
else if (WMOCode < 30)
|
default -> Condition.ERROR;
|
||||||
return Condition.RAINY;
|
};
|
||||||
else if (WMOCode < 50)
|
|
||||||
return Condition.CLOUDY;
|
|
||||||
else
|
|
||||||
return Condition.RAINY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user