loop browse the last 13 months

60 views
Skip to first unread message

P C

unread,
Aug 29, 2021, 8:01:40 AM8/29/21
to weewx-user

Hello,
In the tag, you show a loop that browsing the months of the year.
How could I browse the last 13 months. So for example here from August 2020 to August 2021
Thank you !

gjr80

unread,
Aug 30, 2021, 5:16:53 AM8/30/21
to weewx-user
Hi,

Not certain exactly what you are after, do you want to iterate over the last 13 months using a similar approach to the example in the Customization Guide for iterating over this years months, ie:

#for $month in $year.months
$month.dateTime.format("%B"): Min, max temperatures: $month.outTemp.min $month.outTemp.max
#end for

If so you can use the $span tag in place of the $year tag as follows:

#for $month in $span($month_delta=12).months
$month.dateTime.format("%B"): Min, max temperatures: $month.outTemp.min $month.outTemp.max
#end for

this will display the max and min monthly temperatures for the last 13 months including the current month, eg (the ° gives a ° symbol on a HTML page and is due to the skin using encoding = html_entities):

August: Min, max temperatures: 3.8°C 28.1°C
September: Min, max temperatures: 6.6°C 30.6°C
October: Min, max temperatures: 11.8°C 31.1°C
November: Min, max temperatures: 14.7°C 33.8°C
December: Min, max temperatures: 17.1°C 37.3°C
January: Min, max temperatures: 17.3°C 35.0°C
February: Min, max temperatures: 18.0°C 35.6°C
March: Min, max temperatures: 15.9°C 32.1°C
April: Min, max temperatures: 9.1°C 33.8°C
May: Min, max temperatures: 6.8°C 28.5°C
June: Min, max temperatures: 3.5°C 24.0°C
July: Min, max temperatures: 3.6°C 26.2°C
August: Min, max temperatures: 4.9°C 28.3°C

Gary

P C

unread,
Sep 1, 2021, 9:59:53 AM9/1/21
to weewx-user
Ok, merci Gary, cela fonctionne.
J'ai une autre question concernant wee_debug, mais je la poserais dans un autre topic

Ok, thanks Gary, it works.
I have another question regarding wee_debug, but I would ask it in another topic
Reply all
Reply to author
Forward
0 new messages