Hi
We want to add below code or similar to its action to the NOAA monthly
report file "*NOAA-%Y-%m.txt.tmpl*" but we do not know if it is possible to
do so because of the span tags?
<table>
<tr>
<th>day</th>
<th>sunrise</th>
<th>sunset</th>
<th>avg. temperature while sun is up</th>
</tr>
#for $span in $LMTmonth.daylights
<tr>
<td>$span.dateTime.format("%d")</td>
<td>$span.start</td>
<td>$span.end</td>
<td>$span.outTemp.avg</td>
</tr>
#end for
</table>
thank you for your help
On Monday, January 30, 2023 at 3:45:53 PM UTC+3 Rory Gillies wrote:
> Thanks Again Karen K! It needed a little bit of tweaking but now it’s
> working great. Here’s the working code extract from week.html.tmpl:
>
> <div class="col-3 text-muted font-small">
> #from weewx.units import ValueTuple, ValueHelper
> #attr $dayradiationacc=0
> #attr $n=0
> #for $dd in $year.days
> #set $light=$daylight(timestamp=$dd)
> #set $dayradiation=$light.radiation.avg.raw
>
> #if $dayradiation is not None
> #set $dayradiationacc=$dayradiationacc+$dayradiation
> #set $n=$n+1
> #end if
> #end for
> #if $n is not None
>
> #set $dayradiationavg=$dayradiationacc/$n
>
> #set
> $dayradiation_vh=ValueHelper(ValueTuple($dayradiationavg,$unit.unit_type.radiation,'group_radiation'),formatter=$station.formatter)
> #else
> #set $dayradiation_vh=0
> #end if
>
> $dayradiation_vh <br>
> $Extras.Translations[$Extras.language].avg
> </div>
>
> I had to change the initial values for $dayradiationacc and $n to #attr=
> rather than #set=, and I put in a test for $n is not None to avoid a divide
> by zero error at the start of a new week / month / year before the
> $daylight tag returns a value > 1
>
> You can see it in action here:
> https://www.360shetland.co.uk/weather/week.html
>
> Using the standard $week.radiation.avg tag returns a very low value
> (around 4w/sqm prior to getting this working) as it is averaging each day
> over 24 hours.
>
> Cheers!
>
> Rory
>
> On 28 Jan 2023, at 19:45, Karen K <[email protected]> wrote:
>
>
> #from weewx.units import ValueTuple, ValueHelper
> #set $dayradiationacc=0
> #set $n=0
> #for $dd in $week.days
> #set $light=$daylight(timestamp=$dd)
> #set $dayradiation=$light.radiation.sum.raw
> #if $dayradiation is not None
> #set $dayradiationacc=$dayradiationacc+$dayradiation
> #set $n=$n+1
> # end if
> #end for
> #set $dayradiationavg=$dayradiationacc/$n
> #set
> $dayradiation_vh=ValueHelper(ValueTuple($dayradiationavg,$unit.unit_type.radiation,'group_radiation'),formatter=$station.formatter)
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "weewx-user" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/weewx-user/7CPWHA8azqY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/79c7e465-551b-43dd-84d3-08a7129be8c4n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/weewx-user/79c7e465-551b-43dd-84d3-08a7129be8c4n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/ba1ad1ff-1562-420e-b801-cf393212896en%40googlegroups.com.