n0bel / PiClock

A Fancy Clock built around a monitor and a Raspberry Pi
MIT License
566 stars 182 forks source link

Weather forecast units is hardcoded 'us' #124

Closed BertLindeman closed 3 years ago

BertLindeman commented 5 years ago

Maybe 'auto' would be the easiest choice for units in def getwx().

    wxurl += str(Config.location.lat) + ',' + \
        str(Config.location.lng)
    wxurl += '?units=auto&lang=' + Config.Language.lower() # /BL hardcoded units, maybe auto easier than us?

For me it resulted in a forecast with snow height in inches. Would like mm or even cm ;-)

BertLindeman commented 5 years ago

There are conversions in PyQtPiClock that produce curious results if I use auto for the units ;-) Currently the temperature in about minus 1.3 Celsius and "converted from Fahrenheit into Celsius" So I was thinking a bit too easy about this. Picture with the wrong values ;-)

image

Minus 20 Celsius is here very rare, for @xenon462 it is more common ;-)

xenon462 commented 5 years ago

I removed the multiplication by the coefficient. Everything is working fine for me. 7

BertLindeman commented 5 years ago

Ah, so not so difficult, but to generalize it sti;; takes some programming the conversion depending on the units variable. Thank you for the update.

BertLindeman commented 5 years ago

Just some doc from DarkSky website

Doc from DarkSky:

units=[units] optional

Return weather conditions in the requested units. [units] should be one of the following:

SI units are as follows:

summary: Any summaries containing temperature or snow accumulation units will have their values in degrees Celsius or in centimeters (respectively).

A test shows:

If units=auto is used, the units used is reported back in the json flag field like this:

  "flags": {
    "sources": [
      "meteoalarm",
      "cmc",
      "gfs",
      "icon",
      "isd",
      "madis"
    ],
    "meteoalarm-license": "Based on data from EUMETNET - MeteoAlarm [https://www.meteoalarm.eu/]. Time delays between this website and the MeteoAlarm website are possible; for the most up to date information about alert levels as published by the participating National Meteorological Services please use the MeteoAlarm website.",
    "nearest-station": 7.345,
    "units": "si"
  },