# WeatherIndex

``````
// 체감온도값 = 13.12 + 0.6215*T - 11.37 * V^0.16 + 0.3965 * V^0.16 * T [ T: 기온(섭씨), V : 풍속(km/h) ]
public static double calculate(double T, double W) {
double V = fromMStoKMH(W);
double value = 0.0;
if (V > 4.8) {
value = 13.12 + 0.6215*T - 11.37 * Math.pow(V, 0.16) + 0.3965 * Math.pow(V, 0.16) * T;
if (value > T) {
value = T;
}
}
else {
value = T;
}
value = Math.round(value);
return value;
}
``````
``````
// 열지수값 = -42.379 + (2.04901523*F) + (10.14333127*R) - (0.22475541*F*R) - (0.00683770*F*F) - (0.05481717*R*R) + (0.00122874*F*F*R) + (0.00085282*F*R*R) - (0.00000199*F*F*R*R) [F: 화씨온도, R: 상대습도]
public static double calculate(double T, double R) {
double F = fromCelsiusToFahrenheit(T);
double value = -42.379 + (2.04901523*F) + (10.14333127*R) - (0.22475541*F*R) - (0.00683770*F*F) - (0.05481717*R*R) + (0.00122874*F*F*R) + (0.00085282*F*R*R) - (0.00000199*F*F*R*R);
if (R < 13.0 && F >= 80.0 && F <= 112.0) {
adj = 0.25 * (13.0 - R) * Math.sqrt((17.0 - Math.abs(F - 95.0)) / 17.0);
}
if (R > 85.0 && F >= 80.0 && F <= 87) {
adj = (R - 85.0)/10.0 * (87.0 - F) / 5.0;
}
if (F < 80.0) {
value = F;
}
value = fromFahrenheitToCelsius(value); // (celsius)
value = Math.round(value * 10) / 10.0; // 소수점 첫째자리 반올림
return value;
}
``````
``````
// 부패지수값 = (RH - 65)/14 * (1.054^T) [RH: 상대습도 (%), T: 기온 (섭씨)]
public static double calculate(double T, double RH) {
double value = (RH - 65.0)/14.0 * Math.pow(1.054, T);
value = Math.round(value * 100) / 100.0; // 소수점 두째자리 반올림

return value;
}
``````