WangDaYeeeeee / GeometricWeather

A Material Design Weather Application
GNU Lesser General Public License v3.0
2.44k stars 186 forks source link

Unit of measurement in forecast is always metric #176

Open ps2aux opened 3 years ago

ps2aux commented 3 years ago

Regardless of the units I've selected in the settings, the forecast is delivered to me in Celsius.

My guess is that the AccuWeather API is returning your requests in Celsius, and a quick client side conversion is in order. Unfortunately, that's just a shot in the dark, as I don't have access to a packet sniffer at my current location. Screenshot_20210203-221248 Screenshot_20210203-222012

BradB58 commented 1 year ago

I confirm this is happening on both Android 10 and 11.

papjul commented 1 year ago

This text is not generated by Geometric Weather (these words don't appear in the translation files). Please check weather on AccuWeather official website and let us know if you can find the same sentence.

BradB58 commented 1 year ago

Here is an example of the difference between the AccuWeather website and the Geometric app. There is often a discrepancy of a degree or two on the temperatures, not a big deal, but kind of strange. What I find very odd though, is that the temperature is in Fahrenheit, but the snow is given in centimeters. 2022-12-22_18-53 Screenshot_20221222-185416_Geometric_Weather

BradB58 commented 1 year ago

OK, so I just ran a little test. It sure looks to me like we have a bug here. I changed the temperature unit settings and it most definitely does affect the forecast text even though not generated by Geometric Weather. However changing the precipitation unit setting does nothing for the forecast text. Does this not indicate that something was overlooked in the code that connects the precipitation setting to the forecast? example_1 example_2

papjul commented 1 year ago

Since then, I had a look at AccuWeather code, and here is what happens: 1) Data is always requested in metric (it is converted on display if the user preferes another unit) 2) The weather text returned by the API is different if you request metric or imperial. Since we are requesting metric, you will have imperial units for number data (converted from metric on display) and metric units for text data. 3) There is a built-in function to parse this weather text and change the unit, but it seems to no longer work. 4) You can't request data in imperial directly (and do a different conversion for numbers in that case: imperial (API) > metric (database) > imperial (on display)) because there are actually 4 units available in Geometric Weather, just for precipitation (let alone the other data to handle).

The customization possibilities of Geometric Weather are not making it easy to find a solution.