Closed cloneofghosts closed 1 week ago
@alexander0042 I did a quick apparent temperature calculation using the formula using these values:
"temperature": 20.2,
"dewPoint": 16.37,
"humidity": 0.75,
"windSpeed": 5.83,
When I did the calculations myself I get 17.674814263 but the API is returning 12.5 which is a more than 5 degree difference.
This is a great catch, thanks for finding it! It's exactly the sort of thing I'm hoping happens with self hosting, so an encouraging sign of things to come! I've tagged this for the next release, since it's pretty urgent, so should integrate this week!
Fix for this is live in 2.4.0! Thanks again both finding the bug and the solution, it really is the dream combo!
Comparing both endpoints I see the same apparent temperature. When I plug in the formula in my calculator I get different results still compared to the API.
Here's how I calculated it:
0.77 × 6.105 × e(17.27 × 8.2 / (237.7 + 8.2)) = 7.358995487
8.2 + 0.33 × 7.358995487 − 0.70 × 4.48 − 4.00 = 3.492468511
When I compare to the API I see: -0.04. Are you using wind speed in m/s or are you using a different unit?
Yea, I see that, and my calculator is also showing a difference. Something else must be off here, I’ll have to dig into the formula to see where things go off the rails
I wonder if its something to do with the wind speed or temperature? Might have to do some log statements to see what is exactly going on.
Got it! Turns out it was a simple issue- I was using wind gust instead of wind speed, which threw the calculations off!
Did this only affect the currently
block or was it an issue everywhere? The hourly
block looks to be the same as before.
Describe the bug
Was looking through the code yesterday to see if relative humidity was capped at 100% (see #360) I noticed that the apparent temperature formula you have is slightly incorrect.
Basically you either need to separate out the formula for calculating water vapor pressure or add brackets around it and should be setup as below:
AT = Ta + 0.33 × (rh / 100 × 6.105 × exp(17.27 × Ta / (237.7 + Ta))) − 0.70 × ws − 4.00
How its setup now I believe it leads to the apparent temperature being lower than it should be but cannot confirm.
Expected behavior
Apparent temperature calculation has brackets around the water vapor pressure formula
Actual behavior
Apparent temperature calculation is missing brackets around the water vapor pressure formula
API Endpoint
Production
Location
Not applicable
Other details
@alexander0042 This is a good case for the source code to be available. I know you want to try an optimise it more but you could always release as is and add it afterwards? Not sure what the plan is for that as I haven't seen an updated timeline anywhere.
Troubleshooting steps