Need some help with tags / aggregation period

55 views
Skip to first unread message

David Schulz

unread,
Jul 31, 2021, 2:19:46 PM7/31/21
to weewx-user
Hi, i need some help to show the date and temp from 2 years ago. what is the best method to take into account the leap years?


Currently I try it with:

$day($days_ago=730).dateTime.format("%d.%m.%Y")

But the solution is 01.08.2019 for 31.07.2021. Are there any other options?

David Schulz

unread,
Jul 31, 2021, 2:25:45 PM7/31/21
to weewx-user
and days does not work with years.

Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: Generate failed with exception '<class 'TypeError'>'
Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/Belchertown/index.html.tmpl
Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: **** Reason: day() got an unexpected keyword argument 'years_ago'
Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 326, in generate
Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: ****    File "cheetah__etc_weewx_skins_Belchertown_index_html_tmpl_1627749978_8315864_14895.py", line 1764, in respond
Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1708, in _handleCheetahInclude
Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: ****    File "cheetah__etc_weewx_skins_Belchertown_index_hook_after_snapshot_inc_1627754298_769225_26517.py", line 152, in respond
Jul 31 19:58:18 weather weewx[122681] ERROR weewx.cheetahgenerator: ****  TypeError: day() got an unexpected keyword argument 'years_ago'

Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: Generate failed with exception '<class 'TypeError'>'
Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/Belchertown/index.html.tmpl
Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: **** Reason: day() got an unexpected keyword argument 'years_ago'
Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 326, in generate
Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_Belchertown_index_html_tmpl.py", line 1764, in respond
Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1708, in _handleCheetahInclude
Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_Belchertown_index_hook_after_snapshot_inc.py", line 152, in respond
Jul 31 19:58:21 weather wee_reports[133909] ERROR weewx.cheetahgenerator: ****  TypeError: day() got an unexpected keyword argument 'years_ago'

vince

unread,
Jul 31, 2021, 2:54:21 PM7/31/21
to weewx-user
Leap years are difficult without doing a lot of coding.

When you reach the next Feb-29th what would you expect for 'last year on this date' ?


David Schulz

unread,
Jul 31, 2021, 2:59:29 PM7/31/21
to weewx-user
really good question... 01. of march? actually i fixed it with $day($days_ago=731).dateTime.format("%d.%m.%Y").

vince

unread,
Jul 31, 2021, 4:09:40 PM7/31/21
to weewx-user
yeah, that works until the next time it's 730.
Reply all
Reply to author
Forward
0 new messages