marquee-scroller
marquee-scroller copied to clipboard
Daily high/low is incorrect
According to the API documentation for the https://openweathermap.org/current API call, the temp_min and temp_max are not the daily min and max temperatures, but rather the min and max observed in a city at that moment.
This is to account for differences across a large city (for example, New York City).
Here is the relevant info regarding this issue (from https://openweathermap.org/current#min):
Please, do not confuse min/max parameters in our weather APIs.
In Current weather API, Hourly forecast API and 5 day / 3 hour forecast API - temp_min and temp_max are optional parameters mean min / max temperature in the city at the current moment just for your reference. For large cities and megalopolises geographically expanded it might be applicable. In most cases both temp_min and temp_max parameters have the same volume as 'temp'. Please, use temp_min and temp_max parameters in current weather API optionally.
In 16 Day forecast - min and max mean maximum and minimum temperature in the day.
The 16-day forecast API requires a paid account, so probably not a good solution.
There is a "One-Call API" that includes forecast information which is accessible to free accounts, and it does appear to include daily high and low temperatures. Info at: https://openweathermap.org/api/one-call-api
One major difference is that it does not take a city ID for location - only lat/lon coordinates. There is also a limit of 1000 calls/day.
One possible solution would be to call the One-Call API once a day for min/max info, then use the current API for the instantaneous weather info. That way, you don't have to worry about the 1000 calls/day limit, and don't have to continually deal with the large amount of data returned by the One-Call API.
For lat/lon, the currently-used API returns this info, so it would not need to be added to the configuration GUI.
Here is an example of the One-Call API call:
https://api.openweathermap.org/data/2.5/onecall?lat=40.17&lon=-105.1&exclude=minutely,hourly&units=imperial&appid=<api_key>
Good catch on the temp_min/temp_max on openweathermap. A secondary API could work, but I'll take a look at just calculating the min/max within the sketch itself without having to go to a secondary source that might be limited. Just need to create variables for the min and the max and compare the current temperature from openweathermap. If it's higher than the current saved high temp, then it's stored as the new high temp. If it's lower than the current low temp, then the current low temp is updated. Reset the high and low temperatures at midnight. Not sure how soon I'll be able to get around to this, but I'll put it on my to do list. -Brandon
Your proposal is fine for reporting on the historical min/max, but I guess my expectation was that this would be a predicted/forecast min/max - in other words, I could look at it in the morning and see how hot (or cold) it was going to get during the day to help answer questions like "what should I wear?", "Do I need a coat?", etc.
The "historical values" might be interesting at the end of the day to see what actually happened (perhaps to compare to the forecast).
Thanks for your reply.
Bryan
On Fri, May 15, 2020 at 1:42 AM Brandon [email protected] wrote:
Good catch on the temp_min/temp_max on openweathermap. A secondary API could work, but I'll take a look at just calculating the min/max within the sketch itself without having to go to a secondary source that might be limited. Just need to create variables for the min and the max and compare the current temperature from openweathermap. If it's higher than the current saved high temp, then it's stored as the new high temp. If it's lower than the current low temp, then the current low temp is updated. Reset the high and low temperatures at midnight. Not sure how soon I'll be able to get around to this, but I'll put it on my to do list. -Brandon
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Qrome/marquee-scroller/issues/137#issuecomment-629084098, or unsubscribe https://github.com/notifications/unsubscribe-auth/APA5XWJOS43Y2DZOECMPTFDRRTW45ANCNFSM4M4V4P4Q .