#set $daylength=$almanac.sun.set - $almanac.sun.rise
<tr>
<td class="label">Day Length:</td>
<td class="data">$daylength</td>
</tr>
I was just thinking about this too. Not that I'm a fan of keeping track of losing daylight this time of year, but always good in the spring. I'll be very interested in this.
Dave-KB1PVH
Sent from my Samsung S4
I just tried that and it displays
Day Length: 37424.7437022
Andrew,
I'm not quite sure where to put that day length format line. I tried a couple different things and it tossed errors and another try made the format line show up as typed instead of giving a value. I know the best answer is probably learn this stuff for myself, and at some point in the near future I would like to.
I'll give it a shot shortly.
Thank you.
--
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+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Haha, I was just going to report that it worked.
That Tom guy is not bad with this stuff, LOL.
Do I dare ask how we (you) could make it say something like
Tomorrow will be x:xx shorter (or longer, depending on time of year)
I understand how to do it in theory, I just lack the implementation skills to do it.
#set $today_secs= $almanac.sun.set.raw - $almanac.sun.rise.raw
#set $hours = $today_secs// 3600
#set $today_secs %= 3600
#set $minutes = $today_secs//60
#set $today_secs %= 60
$("The length of daylight today is %d hours, %d minutes, and %.1f seconds" % ($hours, $minutes, $today_secs))
#set $next_secs = $almanac.sun.next_setting.raw - $almanac.sun.next_rising.raw
#set $hours = $next_secs// 3600
#set $next_secs %= 3600
#set $minutes = $next_secs//60
#set $next_secs %= 60
$("The length of daylight tomorrow is %d hours, %d minutes, and %.1f seconds" % ($hours, $minutes, $next_secs))
#if $next_secs > $today_secs
#set $change=$next_secs-$today_secs
#set $text="Longer"
#else
#set $change=$today_secs - $next_secs
#set $text="Shorter"
#end if
#set $hours = $change// 3600
#set $change %= 3600
#set $minutes = $change//60
#set $change %= 60$("Tomorrow is %d hours, %d minutes, and %.1f seconds $text than today" % ($hours, $minutes, $next_secs))
It helps a great deal, thank you.
Hopefully soon I will be able to learn this stuff a little bit better. All my skills revolve around running into burning buildings when everyone else is running out for 23 years , this software and programming stuff is hard work.
Also, in weewx-wd we format day length as follows (sorry no acces to code tags on iPad):
#import time
#set $dayLengthSeconds = $time.gmtime(round($almanac.sun.set.raw-$almanac.sun.rise.raw,1))
and to display day length:
$time.strftime("%M:%S", $dayLengthSeconds)
Gary
--
Gary
Gary
Tom,
How would we get it to give the difference in minutes and seconds instead of seconds. I don't think I need the 9 places after the decimal for accuracy.
--
I'm not sure where and how that goes, so I'll just leave well enough alone for now. I think I'll wait until the kids are 18 and kick them out so I can have more than 30 seconds to myself to sit down and learn this stuff.
Start civil twilight: | 06:37:40 | 06:41:26 |
Rise: | 07:20:06 | 07:22:15 |
Transit: | 11:56:31 | |
Set: | 16:32:06 | 16:32:06 |
End civil twilight: | 17:14:28 | 17:12:42 |
Hi
I wonder if anyone would be kind enough to share what you actually add to the index file
Ok the first posting did not work but I can keep up with the where and how of
#set $daylength=$almanac.sun.set - $almanac.sun.rise
<tr>
<td
class="label">Day
Length:</td>
<td
class="data">$daylength</td>
</tr>
Moving on to
#set $seconds = $almanac.sun.set.raw - $almanac.sun.rise.raw
#set $hours = $seconds // 3600
#set $seconds %= 3600
#set $minutes = $seconds //60
#set $seconds %= 60
$("The length of daylight is %d hours, %d minutes, and %.1f seconds" % ($hours, $minutes, $seconds))
I tried adding a class label and class data but it just displayed text ($hours, $minutes, $seconds))
Thanks for your help
This is probably another question because I know nothing (almost) about Python.I have sunrise & sunset, how can I calculate the day length from them? Obviously daylength = sunset - sunrise, but the syntax? This is what I have tried and it doesn't work!
#set $daylength=$almanac.sun.set - $almanac.sun.rise
<tr>
<td class="label">Day Length:</td>
<td class="data">$daylength</td>
</tr>
--
#end if
<tr>
<td class="label">Phase:</td>
<td class="data">$almanac.moon_phase<br/>($almanac.moon_fullness% full)</td>
</tr>
</table>
</div> <!-- end class "celestial_body" -->
#set $now = $current.dateTime.raw
#set $yesterday = $now - 24*3600
#set $today_daylight = $almanac.sun.set.raw - $almanac.sun.rise.raw
#set $yesterday_daylight = $almanac($almanac_time=$yesterday).sun.set.raw - $almanac($almanac_time=$yesterday).sun.rise.raw
#set $difference = $today_daylight - $yesterday_daylight
#set $seconds = $almanac.sun.set.raw - $almanac.sun.rise.raw
#set $hours = $seconds //3600
#set $seconds %= 3600
#set $minutes = $seconds//60
#set $seconds %= 60
<p>$("Today has %d hours, %d minutes, and %d seconds of daylight" % ($hours, $minutes, $seconds)),<br/>
#if $difference > 0
$("%d seconds more than yesterday." % $difference)</p>
#else
$("%d seconds less than yesterday." % -$difference)</p>
#end if
#else
## No extended almanac information available. Fall back to a simple table.
<table>
<tr>
<td class="label">Sunrise:</td>
<td class="data">$almanac.sunrise</td>
</tr>
--
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/gc1urPvD_1M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.