Hi Nigel,
> I installed your wxobs and it worked straight out of the box - well nearly ! > The default units are in imperial and I would like a mix of imperial and > metric. > i.e. > Temperature units to be in metric > Wind units to be in imperial > Barometer to be hPa Units is the downside of bypassing the weewx engine and using straight php. We don't get the benefit of the unit adjustments that weewx makes. I'll be the first to admit I'm still learning how that impacts this skin, especially with the various setups it may be used under but I am getting a handle on it, and most importantly; What you want can be done. Currently, It all to be handled within the php skin. >From my understanding, a driver will deliver the data to weewx and it will specify what the overall unit system will be (say USunits) and also what each individual data field will be (say inHg for barometer). If (for example) your weewx.conf target_units has been kept at the default of US units then your barometer will be stored as is (unaltered). If instead you've nominated to use a METRIC database then weewx will convert and store that value as mbar. (see /usr/share/weewx/weewx/units.py lines 171 for inHG and US, and 200 for the METRIC equivalent) If we were using weewx to generate our data, none of this would matter as weewx would do it based on our UNIT_GROUP selection. Instead we need to do it all. So from weewx-wxobs point of view. The unit that is stored in the database is the actual value. It needs to be converted to the one you want displayed. There is a working example in wxobs.py and wxobs.inc named wind_adjust. I use that to convert my metres_per_second database (METRICWX) value to the one I want km_per_hour by uncommenting the #wind_adjust = 0.277778 # m/s to kmh line in skin.conf > > I'm using a Vantage Pro2 and MySQL db. > > I haven't played around with wxobs skin.conf much but did try the [Units] > [[Groups]] settings but that only changed the column headers, not the > displayed data. Correct, that's what it does; and also Gotcha! That's something that I need to clarify in the instructions. What it's doing there is a cheap way to pull in the unit label. I'm making the assumption (Ooops) that the data is stored in the correct units. If you want to convert that data to something else, that will need to be done as outlined above, then we pick an appropriate label from weewx, the one that matches what we've selected or generated. It's a convenient and user friendly way to change the unit - using the somewhat familiar weewx way rather than editing the php file directly) > I also notice that the Barometer is always reporting 30.1 for today - that's > not right quite right (although accurate to 0.1 I guess) Have a look in wxobs.inc For each occurrence of $metPress change the last digit to the number of decimal places you want. eg:- $metPress = round($row[8], 1); // that , 1 is 1 place changing the last digit to 2 will be two places $metPress = round($row[8], 2); // that , 2 is 2 place https://secure.php.net/manual/en/function.round.php > Check it out here > http://www.nthead.co.uk/weewx/wxobs/index.php Looks just like a bought one ;-) I see it's the latest version too, the one that accommodates the Aus way of counting rainfall (Australian 9am to 9am) Of interest, how does Britain do it? Are we (in Oz) really all that unique? > Thanks for your efforts and I'm happy to tinker. Happy to help, Right now I'm committed elsewhere so can't spend the time creating and testing! the required functions (directly in the php, that's probably the best way to go) but when I get the time I'll do it. In the meantime if you hit the tinker button and need a quick pointer then contact me offlist, I think my email displays above? see /usr/share/weewx/weewx/units.py for the conversion formulas to use > Temperature units to be in metric > Wind units to be in imperial > Barometer to be hPa All doable, but the first thing to know is what units these values are stored in 'your' database, I'm guessing degr F, mph and inHG - but that's where I usually get myself into trouble - making assumptions :-) Also see Powerin's original php script mentioned in one of my earlier posts, he? had some conversions within his if I recall correctly. > > Nigel. > Cheers Glenn rorpi - read only raspberry pi + weewx: now with scripts -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
