I’ve been sitting here writing everything out in my notebook and when looking at the example provided of the JSON data that will be returned I noticed the temperature for that location is 22 degrees… yet it’s light rain rather than snow, which tells me it’s naturally returned as C or F based on the coordinates provided in the request. Is there anything in the data that indicates whether it’s C or F that I can check logically to know which symbol to display and base the logic of my toggle button? I haven’t seen anything that stands out to me showing that. I could make some switch cases or if conditions to work out the logic of 22 degrees of rain rather than snow must mean C, but it can be a “clear sunny day” on a cold 22 degree F day. How can we know this to compensate for it? It would help a lot with toggling the photos we use for the background too.
I assume it’s returning celsius always. Science tends to prefer the metric system.
Some APIs return the default units , I remember a similar question for thedark sky API
For this case however, I’m not sure of the API you are using so can not say. Easy check to see if the API is using static or variable temp units is to manually set the coordinates to the U.S and
see if it returns in Fahrenheit, if so the API probably will also return the default units.
Openweathermap and Dark Sky APIs allows you to include
units=*** in the query string.
The darksky api can provide values of various parameters in various units as said in its documentation.
The default unit is ‘Imperial Units’ similar to US engineering standards, where temperature is given in Fahrenheit.
We can access the data in any of the available units by giving specific functions in the request such as SI unit where temperature will be in Celsius.
Anyway Fahrenheit is the default unit for temperature you receive if you didn’t give any special request.
Referred : https://physics.stackexchange.com/questions/176128/what-unit-system-does-fahrenheit-belong-to
Darksky documentation : https://darksky.net/dev/docs#forecast-request
Maybe that’s changed - when I studied engineering, they pounded into our heads to always use the metric system. Even if the input and output were in imperial, we usually converted to metric first.