Thanks. On further digging i also see that sarogata skin has function for monthly stats across years. Looks like something i can steak my code from!
On Sun, 14 Aug, 2022, 19:58 Tom Keffer, <[email protected]> wrote: > It's true that there is no "monthly summary" table, but that shouldn't > stop you from doing an xtypes extension. I think all that would be > necessary is to modify the SQL queries slightly in weewx-xaggs > <https://github.com/tkeffer/weewx-xaggs>. For example, to return the all > time historical high for a month the query (line 45 > <https://github.com/tkeffer/weewx-xaggs/blob/master/bin/user/xaggs.py#L45> > ) > > "SELECT MAX(`max`) FROM {table}_day_{obs_type} " > "WHERE STRFTIME('%m-%d', dateTime,'unixepoch','localtime') > = '{month:02d}-{day:02d}';", > > > becomes > > "SELECT MAX(`max`) FROM {table}_day_{obs_type} " > "WHERE STRFTIME('%m', dateTime,'unixepoch','localtime') = > '{month:02d}';", > > > and so on. Call it something like "historical_month_max". That leaves the > problem of where does "month" come from. In weewx-xaggs, it comes from the > month of the date whose page is being generated. However, you want it for a > specific month, not necessarily "today." You can use the optional parameter > "option_dict" to set it (requires WeeWX V4.8 or greater). Then your > template looks like > > #for month in range(1,13) > # <p>The historical high for month $month is > $alltime.outTemp.historical_month_max($month)</p> > #end for > > Unfortunately, "option_dict" is not documented in the xtypes wiki > <https://github.com/weewx/weewx/wiki/WeeWX-V4-user-defined-types>. I'll > try to get around to that today. Or, perhaps Gary can do it. > > I realize this is a rather "stream-of-consciousness" post. Hope I'm making > myself clear. > > -tk > > On Sun, Aug 14, 2022 at 3:30 AM Praveen Chandrasekaran < > [email protected]> wrote: > >> Finally managed to get a page like what I wanted up for one month: >> >> http://bedi.co.in/~pcws/tabular.html?report=Climatalogy.txt >> >> Attached template file used for same. >> >> Some inputs on below would be helpful: >> >> 1) The way it is done now, I need to have 12 templates - one for each >> file. With changes in just 2 lines. Looking for a way to do it smarter. I >> see that SummaryByMonth etc creates timespans and loops. But in this >> scenario, the timespans I am interested in are not continuous (Jan of each >> year, Feb of each year and so on). So I dont think I can create timespans >> for these >> 2) xaggs may not work I think since it seems to query daily summary from >> db. There is no monthly summary in db however as I understand >> 3) How do I make different month templates run at different times. No >> point in running for month off Jan daily in August for example. >> >> PS : I am a noob on cheetah etc. Just reading through stuff now to get >> hang of things. >> On Saturday, 13 August 2022 at 19:30:46 UTC+5:30 Tom Keffer wrote: >> >>> So you did! Here's my response: >>> >>> There's no explicit tag to do that. You could loop over all months, then >>> test the date to see if it is in a particular month. Something like (NOT >>> TESTED): >>> >>> #for month in $alltime.months >>> # if month.start.format("%b") == 'Jun' >>> # <p>Max for year $month.start.format("%Y") is $month.outTemp.max</p> >>> # end if >>> #end for >>> >>> Alternatively, you could write an xtypes extension and create a new >>> aggregation type. Similar to the "historical_min" and "historical_max" >>> aggregations in the weewx-xaggs <https://github.com/tkeffer/weewx-xaggs> >>> extension, >>> except it would be the historical min and max for the month, instead of the >>> day. >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "weewx-development" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-development/e6b5d587-912f-41ae-b3af-0e6dbd0f5d7bn%40googlegroups.com >> <https://groups.google.com/d/msgid/weewx-development/e6b5d587-912f-41ae-b3af-0e6dbd0f5d7bn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "weewx-development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/CA%2BW%3DTmXjHZAAg%2B_urOr_zrXaTWWtLVENG%3DbqpQfWXMAnTwa82g%40mail.gmail.com.
