I missed the nthead website and was just looking at the screenshot. It would definitely require direct database access unless, as you say, you keep lots of old pages around (which is what wview, the predecessor to weewx, did.)
In any case, it was an early design decision not to entangle the HTML pages with database access. It requires colocation of the database and the webserver, which most people can't do. Sorry to interrupt. Carry on! -tk On Fri, Sep 22, 2017 at 4:40 PM, Glenn McKechnie <[email protected]> wrote: > My knowledge of python and the workings of weewx? They may both be > improving as I do things like this but I'm starting from a low base. > > A search of weewx-user for what I wanted turned up Powerin's posting > and that gave me a working example that I could template from. > > I could probably have worked out how to generate the current days data > quickly enough as the default template shows eg; at > http://www.nthead.co.uk/weewx/wxobs/index.php but when using the > datepicker to access the historical data I couldn't grok weewx going > that far back and generating it all on the fly. > > I could see that perhaps each historical page could be generated by > weewx but how to ask weewx to generate a report for a select date, > without generating everything and storing it somewhere (on the off > chance it would be used or even wanted) , or waiting for the report > cycle to churn and somehow injecting a request from the user into it > for the next run? > This way the response is immediate (If it's sqlite there may be a lock > conflict if you're unlucky in the timing, mysql should handle multiple > access seamlessly?) > > I'll be the first to admit I don't need access to all the history, > just the last couple of days suits at the moment to compare data with > the local airport. But it has been interesting using this in > conjunction with the NOAA data to see when rain fell, and then see how > the old rain was spread over that day using the datepicker. > > Cheers > Glenn > > rorpi - read only raspberry pi + weewx: now with scripts > > > On 23 September 2017 at 08:45, Thomas Keffer <[email protected]> wrote: > > I guess I'd be curious what drove you to do a skin using php, > particularly > > one with independent database access. I don't see anything in your > > screenshot that can't be done with a stock version of weewx. It wouldn't > > even require a search list extension. > > > > Or, am I missing something? > > > > -tk > > > > On Fri, Sep 22, 2017 at 3:32 PM, Glenn McKechnie < > [email protected]> > > wrote: > >> > >> 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. > > > > > > -- > > 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. > > -- > 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. > -- 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.
