Here are the differences we found between the Python package and the R package for calculating the cooling effect:
Determination of wind speed conditions
In python, When the wind speed is less than or equal to 0.1 m/s, the cooling effect is directly returned to 0. link
if vr <= 0.1:
return 0
In R, A wind speed threshold of 0.2 m/s is used, if the wind speed is below this value, the cooling effect is 0. link
if (vel <= 0.2){
ce = 0
warning('For velocity less than or equal to 0.2, cooling effect is Zero')
print(paste0("Cooling Effect: ", ce ))
}
Calculation logic of cooling effect
In python, Use the scipy.optimize.brentq function to perform a bisection root search in the interval [0, 40]. link
ce = optimize.brentq(function, 0.0, 40)
In R, Use a custom bisect function to perform a bisection root search in the interval [0, 15] link
ce = bisect(f,0,15)
The Python version searches in the interval [0, 40], while the R version searches in the interval [0, 15]. This may cause the R version to fail to find the solution correctly at higher temperature differences. I did reduce the number of cases where I failed after changing to [0, 40] in R.
Output issues
In python, Use the round() function to round the result to two decimal places. link
return round(ce, 2)
In R, The ce value is not returned, so there will be some problems when testing. We have corrected it and kept it consistent. link
Here are the differences we found between the Python package and the R package for calculating the cooling effect:
Determination of wind speed conditions
In python, When the wind speed is less than or equal to 0.1 m/s, the cooling effect is directly returned to 0. link
In R, A wind speed threshold of 0.2 m/s is used, if the wind speed is below this value, the cooling effect is 0. link
Calculation logic of cooling effect
In python, Use the scipy.optimize.brentq function to perform a bisection root search in the interval [0, 40]. link
In R, Use a custom bisect function to perform a bisection root search in the interval [0, 15] link
The Python version searches in the interval [0, 40], while the R version searches in the interval [0, 15]. This may cause the R version to fail to find the solution correctly at higher temperature differences. I did reduce the number of cases where I failed after changing to [0, 40] in R.
Output issues
In python, Use the round() function to round the result to two decimal places. link
In R, The ce value is not returned, so there will be some problems when testing. We have corrected it and kept it consistent. link