Add the wind annoyance factor from Buddy and placeholders for a new Feels Like calculation.
This commit is contained in:
parent
6e2d293cdc
commit
4132aa0f83
@ -12,7 +12,9 @@ String formatOpenWeatherData(var data) {
|
||||
humidity = pullOpenWeatherHumidity(data);
|
||||
|
||||
String windChill = getWindChill(temp, windSpeed),
|
||||
heatIndex = getHeatIndex(temp, humidity);
|
||||
heatIndex = getHeatIndex(temp, humidity),
|
||||
windAnnoyance = getWindAnnoyance(temp, windSpeed),
|
||||
feelsLike = getUniversalThermalClimateIndex();
|
||||
|
||||
String comfort = "";
|
||||
|
||||
@ -22,6 +24,8 @@ String formatOpenWeatherData(var data) {
|
||||
" and humidity of $humidity$humidityUnits."
|
||||
" $windChill"
|
||||
" $heatIndex"
|
||||
" $windAnnoyance"
|
||||
" $feelsLike"
|
||||
" $comfort";
|
||||
|
||||
final String doubleSpace = " ", singleSpace = " ";
|
||||
@ -142,3 +146,32 @@ String getHeatIndex(String temp, String humidity) {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
double calcWindAnnoyance(double temp, double windSpeed) {
|
||||
double windAnnoyance = (temp / (windSpeed * (windSpeed * 0.05)));
|
||||
|
||||
if (debug) {
|
||||
debugPrint("DEBUG: windAnnoyance = '$windAnnoyance'");
|
||||
}
|
||||
return windAnnoyance;
|
||||
}
|
||||
|
||||
String getWindAnnoyance(String temp, String windSpeed) {
|
||||
double temperature = double.parse(temp);
|
||||
double wind = double.parse(windSpeed);
|
||||
|
||||
double windAnnoyance = calcWindAnnoyance(temperature, wind);
|
||||
|
||||
if (windAnnoyance < 3) {
|
||||
return "Wind may be a bit much for the temperature.";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
double calcUniversalThermalClimateIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
String getUniversalThermalClimateIndex() {
|
||||
return "";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user