Have you thought about doing this with a database query? On Wed, Dec 18, 2024 at 11:55 AM 'Rory Gillies' via weewx-user < weewx-user@googlegroups.com> wrote:
> Hi, at first I thought this would be quite easy but I'm struggling a bit. > The background is I need a text file to import into WXSim using the Cumulus > %Y%mlog.txt format. I created a simple skin that generates the %Y%mlog.txt > each reporting cycle (5 minutes in my case), but is there a way to append > the next cycle to the existing file as a new line rather than overwrite it? > > My skin.conf looks like this: > > [CheetahGenerator] > encoding = utf8 > > [[ToDate]] > [[[text-data]]] > template = %Y%mlog.txt.tmpl > > [CopyGenerator] > copy_always = *.txt > > [Generators] > generator_list = weewx.cheetahgenerator.CheetahGenerator, > weewx.reportengine.CopyGenerator > > And the template: > > #encoding UTF-8 > #errorCatcher Echo > ## +------------------------------------------------------+ > ## | Cumulus Monthly Output Template | > ## +------------------------------------------------------+ > ## | Produces a YYYYmmlog.txt output for import to WXSim | > ## +------------------------------------------------------+ > > > > $current.dateTime,$current.outTemp.format(add_label=False),$current.outHumidity.format(add_label=False),$current.dewpoint.format(add_label=False),$current.windSpeed.format(add_label=False),$current.windGust.format(add_label=False),$current.windDir.format(add_label=False),,,$current.barometer.format(add_label=False),$day.rain.sum.format(add_label=False),,,,,,,$current.radiation.format(add_label=False), > > Which produces a text file called 202412log.txt: > > 18/12/24 19:40:00,6.3,82,3.4,10,37,266,,,982.8,15.4,,,,,,,0, > > WXSim can read this, however it only contains a single observation period. > I would like to append the data to the file until the month is complete, > then generate a new file for the next month. Any ideas? It will likely need > some Python which is not my strongpoint, although I can get around it a > bit... > > I'm running WeeWX 5.1 if it makes it easier. TIA > > -- > 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 weewx-user+unsubscr...@googlegroups.com. > To view this discussion visit > https://groups.google.com/d/msgid/weewx-user/92a4cb34-0516-44f3-8406-2a08b25a4d77n%40googlegroups.com > <https://groups.google.com/d/msgid/weewx-user/92a4cb34-0516-44f3-8406-2a08b25a4d77n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Peter Quinn (415)794-2264 -- 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 weewx-user+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/weewx-user/CAA1SM21PcV83xgA5qqfPF5jgN1J3vwGMqvsXENkAoJVxF68g0Q%40mail.gmail.com.